Hello,
I’d like to launch a coroutine from my main program with his name store in a variable.
In my main, i have something like that :
MethodInfo methodInfoFunction = myTouchGO.GetType ().GetMethod (_cardFunction, BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, new[]{ typeof(MethodInfo), typeof(float)}, null);
myTouchGO.GenericStartMethod (methodInfoFunction, duration);
In my myTouchGo script, i have :
public void GenericStartMethod(MethodInfo functionName, float _duration){
StartCoroutine (functionName.Name, _duration);
}
In my main program, i check the collision and associated element used to collide, this element provide the name of the coroutine.
I’d like a clean code without a lot of “switch case” this is the reason i want to take the coroutine name method in my concerned elements.
Thanks for your help ![]()
More information :
- methodInfoFunction is null on a run.
- myTouchGo is connected to the coroutine function script.
- the string_cardFunction contains the name of the existing coroutine