Game Development Reference
In-Depth Information
for (var callback in _callbacks) {
callback();
}
}
}
If we check out this script, we will see that this script uses List<T> , which is available
in the C# generic library, so we need to use import Sys-
tem.Collections.Generic; .
Note
List<T> is basically similar to JavaScript's the Array or ArrayList type, but we
need to specify the <T> type. This also performs significantly faster than JavaScript's
Array and ArrayList . A good link to understand which type of array to use in Unity
is as follows:
http://wiki.unity3d.com/in-
dex.php?title=Which_Kind_Of_Array_Or_Collection_Should_I_Use?
We will see that we have List to store the Function type. Then, we have Add , Re-
move , Clear , and Invoke functions. The Invoke() function is basically to call all
the functions in List . This is similar to the delegate and event functions in C#.
Search WWH ::




Custom Search