Created
March 3, 2018 13:02
-
-
Save bwheatley/9670359edf13eeaac053e37a89553be4 to your computer and use it in GitHub Desktop.
Being able to serialize a class with generics in Unity Inspector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CameraSettingsGeneric<T, U> | |
{ | |
[HideInInspector] public T camera; | |
public float minZoom = 1f; | |
public float maxZoom = 5f; | |
public float zoomAmount = 5f; | |
[HideInInspector] | |
//public CraftFacade followObject; | |
public U followObject; | |
public bool disableMouse; | |
} | |
[Serializable] | |
public class Settings : CameraSettingsGeneric<tk2dCamera, CraftFacade> { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you create the subclass as a child of CameraSettingsGeneric you're able to serialize the subclass in unity's inspector.