Hey I am about intermidiate now in Unity, but i am still a beginner in some Unity UI concepts. I am wondering how to use your own custom made button images/png rather that the built in Unity buttons (but still can perform the same tasks). Thank you and i hope i can get some answers
you can make anything into a button by adding a script that implements EventSystem.IPointerClickHandler interface (or one of the others for pointer down/up/whatever).
You can see how the unity buttons are coded here: https://bitbucket.org/Unity-Technologies/ui/src/0155c39e05ca5d7dcc97d9974256ef83bc122586/UnityEngine.UI/UI/Core/Button.cs?at=5.2&fileviewer=file-view-default
(which is basically OnPointerClick function calls “Press()” which invokes the events you added to the inspector)
http://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.html
(look at the interfaces listed in the hierarchy on the left for a list)
I think what you mean is just adding UI button like normal and then change its texture in inspector window. Why scripting your own?
Exactly, there’s nothing more to it in the simplest form.
Button is a GameObject with RectTranform, CanvasRenderer, Image and Button components, and it has a child GameObject with RectTransform, CanvasRenderer and Text Component…
You can even get rid of text child object too, if your image has text for example.
So just replace Source Image of Button GameObject.