|
Hi, I'm creating a 1x1 semitransparent white texture and using it to fill a 100x100 rectangle. This is the code
but when i run the game i get NullReferenceException: Object reference not set to an instance of an object UnityEngine.GUI.DrawTexture (Rect position, UnityEngine.Texture image, ScaleMode scaleMode, Boolean alphaBlend, Single imageAspect) UnityEngine.GUI.DrawTexture (Rect position, UnityEngine.Texture image) why?
(comments are locked)
|
|
You can't put GUI functions in Update. Also, creating a texture every frame is not a good idea. --Eric Oh, how dumb of me. thank you, that did it ps. yes, yes i know i should not create a texture every frame. it was just to see if it worked
Aug 13 '10 at 10:46 AM
Patrik
Hey Eric does that include putting it in a method that is invoked inside of update? Because I have that updates a score texture which counts up so it appears inside an update display method.
Jan 24 '11 at 01:31 PM
.hooligan
I get the same error but I've moved my script outside of any Update methods?
Jan 24 '11 at 01:34 PM
.hooligan
You can only use GUI functions in OnGUI.
Jan 24 '11 at 03:45 PM
Eric5h5
(comments are locked)
|
