I have a piece of C# code which I am to convert into C++/CLI for the purpose of connecting C# with C++. Here’s the code:-
using UnityEngine;
using UnityEngine.Events;
public class A
{
public void Func1(int index)
{
}
public void Func2()
{
}
}
public class B : MonoBehaviour
{
UnityEvent event;
private void Start()
{
A aClass = new A();
event.AddListener(() => A.Func1(index)); // This event needs to be without lambdas
event.AddListener(A.Func2);
}
}
Since I am going to convert this code to C++/CLI, I won’t be able to use lambdas as they are not allowed. I also need to pass the specific index that is to be determined by Start(), so I cannot access the index from other functions too.
EDIT: I can’t use local functions too but since they are not allowed in C++/CLI.