- Home /
How do I use my .png file as a button?
Hey, I'm currently trying to make a start menu for my game. I have the menu layout all in unity and looking good. I have a few .png files in the scene sort of floating beside the menu graphics, exactly where I want them to be. A start .png, an Exit.png and a .png for the title of the game. They have a mesh renderer component on them that casts shadows, receives shadows and uses light probes. Basically everything is done, visually. However, I've been attempting and failing at making Start and Exit buttons. At first, I made a transparent button that slightly gets brighter as the mouse pointer hoovers over it. I even attached a script that brought the player to the next screen once it has been clicked on. However, when I played the scene in fullscreen, the button was far to the left of the Start .png. I understand this is due to the resolution change. How do I attach this transparent button to the start.png so that it stays with it everywhere it goes? I have searched on the web for answers and am constantly redirected to this page: http://docs.unity3d.com/Manual/gui-Basics.html
Although that page is helpful, it does nothing for me in this instance.
Can anyone help me attach this button to the png file so that it doesnt budge ?
don't use this UnityGUI use new UI
https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/the-new-ui
Answer by redeemer · May 21, 2015 at 11:59 AM
Select in the create panel in the Hierarchy: Create -> UI -> Button. This will create a new button. Select the button in the Hierarchy and in the Inspector you can see an Image component. In the "Source Image" field put the image you want.
I've been putting my image into the source image of the button and it says it's in there, but it never shows up on screen.
Your answer
Follow this Question
Related Questions
In game right click menu 1 Answer
How to make a simple menu button with C Sharp 1 Answer
GUI Buttons not working after scene transition 0 Answers
Load, Save and Options Gui Help 1 Answer