Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between UnityEngine.Events.Unityaction vs System.Action?

Tags:

c#

unity3d

unity5

What is the difference between UnityEngine.Events.Unityaction vs System.Action.

Can i use System.Action in Unity?

Can i use lambda as UnityAction?

like image 628
AminSojoudi Avatar asked Jun 06 '17 10:06

AminSojoudi


1 Answers

Yes to both questions. For example, these two lines of code are formally the same:

System.Action<GameObject> myaction = (gameobj) => { Debug.Log(gameobj.name); } ;

UnityEngine.Events.UnityAction<GameObject> myaction = (gameobj) => { Debug.Log(gameobj.name); } ;

like image 164
Galandil Avatar answered Oct 15 '22 11:10

Galandil