I have been trying to change the image when a button is pressed, but it always says:
NullReferenceException: Object reference not set to an instance of an object
I already added a sprite to the public Sprite variable but it is still the same.
***This object is an object I created as an empty game object and added the script to it. It also has an image as a child.***
This is my code:
I cannot change the sprite the of the image with script
NullReferenceException: Object reference not set to an instance of an object
I already added a sprite to the public Sprite variable but it is still the same.
***This object is an object I created as an empty game object and added the script to it. It also has an image as a child.***
This is my code:
Code (csharp):
- public Sprite firstImage; // Already added sprite to this in the game
- public...
I cannot change the sprite the of the image with script