unity+action使用函数作为传参(匿名函数)

2023-08-24 13:56:20 浏览数 (2)

代码语言:javascript复制
using UnityEngine;
using System.Collections;
using System;

public class AniScene : MonoBehaviour {

	// Use this for initialization
	void Start () {

        ActionTest((param,param1) =>
        {
            Test((int)param,(int)param1);
        }, 1,2);
    }
	
	// Update is called once per frame
	void Update () {
    }

    void Test(int i,int param1)
    {
        Debug.Log(param1);
    }


    public void ActionTest(Action<object,object> taction, object tparam,object param1)
    {
        taction(tparam, param1);
    }


}

0 人点赞