Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity actions

//An Action is basically an interface for any method which has no return 
//and no input parameters, that's it.

//So you can assign to your Action variable an anonymous method:

class ExampleClass
{
    public static event Action<string> loginSucceededEvent;
}

ExampleClass.loginSucceededEvent = delegate (string str)
{
  //
  // Add your code here;
  //
};

//or you can use this common method:
Action someAction += someMethod1;
Action someAction += someMethod2:
 
someAction(); // <-- calls someMethod1 and someMethod2

// then this happens:
 
void someMethod1()
{
     //something happens here
}
 
void someMethod2()
{
     //something else happens here
}
Source by forum.unity.com #
 
PREVIOUS NEXT
Tagged: #unity #actions
ADD COMMENT
Topic
Name
5+4 =