unity array example

Example 1: unity functinos in array

// Modified version of: https://answers.unity.com/questions/873650/how-to-make-a-list-or-array-of-functions-with-type.html
	// Modified By Malte0621
	delegate void FuncsMethod();
    void CreateList()
    {
        List funcs = new List();
        // Add Functions ...
        funcs.Add(function1);
        funcs.Add(function2);
        // Call Function ...
        funcs[0]();
    }
    // Functions
    void function1()
    {
        Debug.Log("Function 1 called.");
    }
    void function2()
    {
        Debug.Log("Function 2 called.");
    }

Example 2: unity array c#

using System.Collections.Generic;

Example 3: unity array c#

new List();

Tags:

Misc Example