I'm a Unity nob, so please don't flame me for this question.
I'm trying to change a simple UI button to look like a Play button (via simple Play PNG image), I see that the Button have a Source Image
under the Image script, but as far as I can see I must select a Sprite.
How can I create a Sprite from a PNG Image?
Import your PNG by drag your file to the Project panel, Unity will automatically generate texture for you. Click on that file, The Inspector panel will show texture's Import setting. In Inspector, Choose texture type as Sprite (2D and UI), Hit Apply at the bottom. In Project Panel, Drag this texture to your Source Image under Image Script
Unfortunately, unity ui is full of such pitfalls and it's api is totally counter-intuitive, so you have to be careful and check the docs regularly Show activity on this post. You can also just use Image if you are in Unity 2017.3 (not sure if this works for older versions). For example: Works great for me. Show activity on this post.
To change the Image from a Button, don't use GetComponent<Image> () as you can potentially get another Image component that does not belong to the button. It can also return null if the object is disabled. Use the Button.image.sprite or Button.image.overrideSprite variable instead. It really doesn't matter which one is used.
Once the images are in place, go to lighting manager window and change the default skybox to the new material that you just created. Here is the final result of some skybox materials for your reference. To play around with different skybox images, you can use this asset available for free on Unity store.
Unity's sprite is a kind of Texture.
Import your PNG by drag your file to the Project panel, Unity will automatically generate texture for you.
Click on that file, The Inspector panel will show texture's Import setting.
In Inspector, Choose texture type as Sprite (2D and UI), Hit Apply at the bottom.
In Project Panel, Drag this texture to your Source Image under Image Script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With