- Home /
Gui.Button Image in Button - error 1502 and 1503
hey! Iam trying to Put a Image on a button. currently the code looks like that:
//c#
public Texture2D rocket;
void OnGUI()
{
...
if(GUI.Button(startPosBottom, "BUY - " + m_build1.GetComponent<Building>().m_cost + "\nPistol Building", rocket))
...
}
and i got the two errors: - Assets/Scripts/PlayerControls.cs(134,32): error CS1502: The best overloaded method match for UnityEngine.GUI.Button(UnityEngine.Rect, string, UnityEngine.GUIStyle)' has some invalid arguments - Assets/Scripts/PlayerControls.cs(134,32): error CS1503: Argument
#3' cannot convert UnityEngine.Texture2D' expression to type
UnityEngine.GUIStyle'
could you maybe tell me whats wrong with that? also the "rocket" icon is just a rocket.png image (type:texture) that i pasted into a folder assets/icons. is that correct or should mark it as GUI?
Comment