|
I'm using the following code: The problem is that I'm also getting the following error: ArgumentException: You can only call GUI functions from inside OnGUI. It works fine in another script that is running in the same scene, but for some reason this one won't. I looked at the other script, and it's all set up in exactly the same way, but for some reason I'm getting this error all of a sudden.
(comments are locked)
|
|
Your TestScript doesn't inherit from MonoBehaviour so I presume you are calling its OnGUI yourself somewhere - it needs to be called from within a real OnGUI for it to work. Exactly ;)
Jul 13 '12 at 11:41 AM
Bunny83
Yeah, apparently that was the problem. I was calling the OnGUI from within the Update from another script, and a colleague pointed out to me that that was the problem.
Jul 13 '12 at 01:05 PM
kvdleij
(comments are locked)
|
|
I am trying to use a similar thing, but the OnGUI() in the class wont work for the class objects. I want to call a render function in another script that then renders the class object, but the script never runs the OnGUI() function of that class object. What do? Please don't ask additional questions as an answer to a previous question. Use a comment or ask a new question and post a link to the related item. OnGUI is only called in a MonoBehaviour. If you want to write GUi code in another class you must call that code from a MonoBehaviour.
Oct 19 '12 at 07:41 PM
whydoidoit
(comments are locked)
|
