This is part of a custom name space that will bring Invoke methods to editor scripts. I already have “StartEditorCoroutine” working. The problem is that I can’t pass void in as a parameter as seen below.
I have tried changing void to Event but no luck.
thanks in advance
public static EditorTimers EditorInvoke(void method, float time){
}
You’re probably calling it like EditorInvoke (RandomMethod(), 1.0f); try calling it like EditorInvoke(RandomMethod, 1.0f); without the () after the method. Adding () to a method calls the method instead of referencing the method itself.
You could also be using a delegate, which is a lot more straightforward in terms of syntax (IMO) and you don’t need to pull in extra namespaces.
//first, lay out the 'template' of the function:
public delegate void SomeDelegate(int whateverParameters);
//then, the function itself, which is declared as normal
public void SomeFunction(int theSameParameters) {
//do stuff
}
//and now, passing and using it
public void TheMainFunction(SomeDelegate theDelegate) {
theDelegate(3); //call it just like 'theDelegate' was the function name
}
void Update() {
TheMainFunction(SomeFunction);
}