Calling Methods from EZ Gui

I am learning how to script and use EZ Gui... So i want to call a method from a GUI button. I have a script set up on an object that calls a bunch of itweens. But there are a bunch of variables at the beginning that i set up in the Inspector.. If i just call the Method instead of the whole script it does not work.

Maybe i am doing all this wrong i have no idea. Do i have to hardcode the names of everything in my script or can i still use variables and set it up in Inspector?

So i figured out how to access the object through script using GameObject.Find so now i can hard code the variables and use iTweenEvent.GetEvent.Play to play my iTweens but it would be better to be able to use the Inspector to set them up and edit them if at all possible... i am sure there is a way to access Inspector variables from a Method...

1 Answer

1

Ok so it was working just fine the whole time.. But i had a yield WaitForSeconds statement in my script and when i removed it the script worked just fine but it of course lost its delays in between lines... The delays work fine if i set the function as OnMouseDown or something like that but not with EZ Gui for some reason.

Q

So i finally learned that you can not have a Yield statement in the function that you call directly... just a bug or something. So you use a helper function that calls your function with the Yield statement instead... i have not tried it yet but i will..

It's not a bug, the compiler has to know your function is a coroutine for yield to make any sense. Your EZGUI command could call StartCoroutine() on your coroutine which contains the yield.