- Home /
Question by
lqvinh2 · May 29, 2018 at 07:49 AM ·
guigui-button
GUI.Button and Button create from canvas are the same or not. and when i create GUI.Button in void OnGUI() . How to add parent for it. Please help me for understand i am new in Unity
using UnityEngine; using UnityEngine.UI; using System.Collections; using UnityEngine.Networking;
void OnGUI()
{
if (GUI.Button(new Rect(130, 15, 35, 25), "Click"))
{
print("Click button !!!");
}
}
Comment
If you are new then stick with Canvas UI.
OnGui() is for making custom tools and editor not for making game.
And yes they are quite different. OnGui is hard code UI. All UI must be drawn by coding while normal canvas is just drag and drop UI.
Your answer
Follow this Question
Related Questions
problem with gui 2 Answers
GUI.Button not showing up 1 Answer
ExecuteEvents.Execute makes game crash 0 Answers
GUI.Toolbar - Custom on/off button states 2 Answers
Gui Buttons 2 Answers