Tuesday, November 10, 2015

SpriteRenderer on UI

I titled this blog post because it is one of the things that has been wrong and bugging me for several weeks now, probably more like 2 months.

I had a nice GUI being drawn from within the Canvas in Unity and one day I decided to add the Joystick functionality to the game. Seems good for a PC game eh. Well this went smoothly until I added all the appropriate A, B X and Y buttons graphics to the actual button images in the UI. The thing is that only some of them Render in the HUD. Why has baffled me now for all this time, until...

Yes, you guessed it, I have solved the issue and as I expected it is something simply, something obvious really, and I missed it several times trying to solve this bug.

I was using a Sprite renderer in the Canvas, Instead of using a UI->Image. See, told ya it was simple. Changing the images that are not showing up to this kind of renderer has completely fixed the issue, though I have a few more buttons to fix.
As you can see in the above image, the Yes button has the new UI Image for it's button help graphic, and the No button is still using the Sprite renderer instead.

Now I have been busy thinking about and occasionally spending a few minutes writing code to bring in the Main Menu of the game. This also doubles as the Main Menu inside the game when you press escape. It contains the ability to load and save a game, along with several other features, namely Quitting the game. I have about finished this now and this means that very soon now I will move onto the Saving and Loading code... a very exciting development for a Quest and growing based game.

All right, I need to sleep now, been a rough few days health wise.

Laters
Rob

No comments:

Post a Comment