1 using System; 2 using System.Collections; 3 using System.Collections.Generic; 4 using UnityEngine; 5 6 public class weituo : MonoBehaviour { 7 8 // Use this for initialization 9 void Start () {10 Action ac = ppx;11 ac();12 Actionact = ppx1;13 act("ppx");14 Func func = ppx2;15 func();16 Func func1 = ppx3;17 func1(5);18 19 }20 21 private int ppx2()22 {23 Debug.Log("我是有返回值无参数的委托方法");24 return 1;25 }26 private int ppx3(int a)27 {28 Debug.Log("我是有返回值有参数的委托方法");29 return a;30 }31 32 // Update is called once per frame33 void Update () {34 35 }36 public void ppx()37 {38 Debug.Log("我是无返回值无参数的委托方法");39 }40 public void ppx1(string name)41 {42 Debug.Log("我是无返回值有参数的委托方法");43 }44 }