- Home /
how can use GUI.Button? framework don't recognize or suggest the method
the framework don't show me that method, and when i used UnityEditor, and build the game throw me a error message that i have compiler errors, this is the messeges. Assets/ControlCamara.cs(2,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference? but i have in that line this: using UnityEditor;
:S i need unity pro?
Answer by Bunny83 · Sep 15, 2012 at 01:24 AM
You can't use the "UnityEditor" namespace in your normal scripts. This namespace only exists in the editor and should only be used in editor scripts.
The GUI class is part of the "UnityEngine" namespace. This is what you need to import at the top.
using UnityEngine;
All C# script templates actually have this line already included unless you removed it manually.
edit
If you have included the UnityEngine namespace, but the compiler still can't find the Button method, that means you have named your own class GUI and it's hiding the GUI class from UnityEngine. You should rename your class and filename. Never use built-in classnames for your own classes.