I’m having problems creating a simple 2D texture on screen. This is what i’m doing:
Creating a script that has a member property that’s a Texture2D type.
Adding an Empty GameObject to the scene, adding my script to the GameObject and setting the texture property of the script to reference the image in the assets folder.
So, all is well, i’ve put the script in the scene and the script knows which image to use as its texture.
But when i call GUI.DrawTexture(rect, texture) i get
NullReferenceException: Object reference not set to an instance of an object
Logging the value of the Texture tells me it’s an instance of Texture2D and the Rect is ok, too. So i’m not sure what it’s telling me is not instantiated?
Can anyone shed some light on this for me?
T