- Home /
BCE0005 HandleUtility unknown on build?
I´ve got the line:
var gpos : Vector2 = HandleUtility.WorldToGUIPoint(gameObject.transform.position);
which works fine when I start it in Unity. But comes with this error when I try to build any player (e.g. webplayer or standalone):
Assets/MyScripts/HULL.js(13,8): BCE0005: Unknown identifier: 'HandleUtility'.
Any idear what I´m doing wrong? Or workaround?
Answer by syclamoth · Oct 09, 2011 at 10:12 AM
HandleUtility is an editor class! You should only use it inside the UnityEditor, and inside of a folder named 'Editor' so that the compiler knows not to include it when trying to build a standalone. For the same functionality, you should be using Camera.main.WorldToScreenPoint (with some transformations)- it functions using the main camera instead of the 'scene camera'- an invisible, intangible camera which the Editor uses to render the Scene View.
Didn´t notice that there was a difference. Thank you very much !!
Your answer
Follow this Question
Related Questions
BCE 0005 unknown identifier error when accessing global variable. 5 Answers
FPS tutorial projectile scripting error 1 Answer
BCE0005: Unknown identifier 1 Answer
unity not building 1 Answer