is there any way to select gameobject by script in hierarchy ?
i want to make a gameobject be selected in hierarchy as soon as game started. i have tried a solution and actually it worked well but when i built it, selection script doesn't work
Selecting an object in the hierarchy is a pure editor feature. The code you use must call classes / functions from the UnityEditor
namespace. Obviously, when you build, Unity complains.
You have to put every editor-only classes and functions between the following preprocessor directives (including the using UnityEditor;
at the top of your script.
#if UNITY_EDITOR
// Editor-only classes & functions
#endif
Your answer
Follow this Question
Related Questions
Setting GameObject properties in editor when public script fields are changed 2 Answers
Script working in BUILD but NOT in EDITOR 1 Answer
Script working in Editor but not in Build 1 Answer
really weird unity behavior please HELP???? 0 Answers
What BuildTargetGroup option is the right for a linux build? 1 Answer