Event는 DeleGate에서 앞의 Event만 넣어주면 된다.
    myDelegate tempGateA; // 델리게이트
    event myDelegate tempGateB; // 이벤트
차이점은 Delegate는 외부참조 가능
Event는 외부참조 불가능
Event는 Public를 선언해주어도 외부에서 접근이 불가능하다
사용법1
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | delegate void myDelegate(int value); public class GameManager : MonoBehaviour {     event myDelegate tempGateB; // 이벤트     void Start()     {         tempGateB = new myDelegate(Value_A);         tempGateB(10);     }     void Value_A(int value)     {     } } | |

사용법2
Event도 체인을 사용할수있다..
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | delegate void myDelegate(int value); public class GameManager : MonoBehaviour {     event myDelegate tempGateB; // 이벤트     void Start()     {         tempGateB = new myDelegate(Value_A);         tempGateB += Value_B;         tempGateB(10);     }     void Value_A(int value)     {     }     void Value_B(int value)     {     } | |

'Unity(C#)' 카테고리의 다른 글
| Unity(C#) Tuple (0) | 2020.04.24 | 
|---|---|
| Unity(C#)무명형식,무명메소드 (0) | 2020.04.22 | 
| Unity(C#) delegate (0) | 2020.04.21 | 
| Inspector에 변수 재목정하기 (0) | 2020.03.05 | 
| Unity(C#) namespace사용방법 (0) | 2019.11.06 | 
 
                  
                 
                  
                 
                  
                