Last active
August 29, 2015 14:08
-
-
Save frarees/e3eb9dff9a9dcedbb28f to your computer and use it in GitHub Desktop.
Unity Serialization & Interfaces
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
// I'd like to serialize the GetComponents result straight away when getting components via interface | |
// That would avoid allocating more memory for another list that can be serialized | |
// signature: void GetComponents<T, K> (List<T> result) where T : Component; | |
public class MyBehaviour : MonoBehaviour, ICustom { | |
List<MonoBehaviour> behaviours = new List<MonoBehaviour> (); | |
void Awake () { | |
GetComponents<MonoBehaviour, ICustom> (behaviours); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment