I’m following my first tutorial and I want to add an image to the UI (this image is like a score button)
It shuld be fixed in the upper left corner.
I have the PNG imag added to the assets folder. So far I’ve come accross many different answers. And one of those was to make a GUITexture. However I don’t find the path that was mentioned: GameObject → Create Other: GuiTexture. Another option was to drag it onto the scene and change the inspector properties to GUI.
But it seems a lot has changed in the interface of Unity and all this doesn’t work anymore.
Can anyone tell me how to add my PNG image in the corner of the User Interface? (I read something about scripting but I would prefer without it, like it was before with the createOther:GuiTexture)
Which unity version?
4.6 and above uses a new gui-System.
Create → UI → texture and drag your png in the image slot. You have to Import your png as “sprite (2d and gui)” or something similar.
With new UI system you just need to set the PNG import settings texture mode to Sprite. Then you can just use them directly with for example Image objects.
Create, at the top of a Hierarchy panel, is another way to access a set of functions that you can view by right clicking in the hierarchy panel or opening the GameObject menu from the top of the screen.
However, the thing you want is called Image, not Texture. But the title of the thread suggests that you know that already.
Ok so I did create image then and now I have a white image there. So how can I use the PNG image I made that should serve as part of the UI now? (are you sure I shouldn’t use a texture for this because the image is already made in another program)
My image doesnt appear under the sprite assets.
I tried rawimage and then I can choose the PNG but it doesnt look high quality anymore. How come?
Choose image instead of rawimage and in your project folder click on your texture. There is a dropdown at the top of the inspector, “texture” is preselected, click on it and select Sprite (2d or UI).
After that, you should be able to drag your texture (sprite…) into your “Image”-gameobject.
first import your png file in unity. You can do it by just dragging it from the folder to unity project screen [the part where you can see scenes, materials and stuff].
now select the image. In the inspector, you will see texture type it will be set to default. Tap it and set it to sprite(2d and ui)
and there you go, it is that easy all you have to do is change just 1 thing. Now u will be able to drag it into the section where the image goes.