using System; using UnityEngine; using System.Runtime.InteropServices; using GPUECSAnimationBaker.Engine.AnimatorSystem; using Random = UnityEngine.Random; public class MyPlugin : MonoBehaviour { public Material material; public Mesh mesh; const int numInstances = 10; struct MyInstanceData { public Matrix4x4 objectToWorld; public float myOtherData; public uint renderingLayerMask; }; // void Update() // { // RenderParams rp = new RenderParams(material); // MyInstanceData[] instData = new MyInstanceData[numInstances]; // for(int i=0; i(); // GPUAnimtion.Init(gpuEcsAnimatorBehaviour); // } // // [ContextMenu("dsada")] // public void TestSet() // { // GPUAnimtion.SetAnimtionIndex(index); // } // // private void Update() // { // GPUAnimtion.Update(); // // Graphics.DrawMeshInstanced(); // } // // 声明C++函数 // [DllImport("ThreadTool")] // private static extern int Add(int a, int b); // // [DllImport("ThreadTool")] // private static extern void CallCSharpFunction(Callback callback); // // // 定义回调委托 // public delegate int Callback(int value); // // // C#回调函数 // private int MyCallback(int value) // { // Debug.Log("C# received value from C++: " + value); // return value * 2; // } // // void Start() // { // // 调用C++函数 // int result = Add(5, 3); // Debug.Log("Result from C++: " + result); // 输出: Result from C++: 8 // // // 注册C#回调函数并调用C++函数 // CallCSharpFunction(MyCallback); // } }