Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Simple Custom editor using Handles.PositionHandle does nothing. Please help!

$
0
0
Hi all, I am writing a simple custom editor to allow for better positioning of colliders within my game objects. The code is simple: @CustomEditor(ColliderContainer) @CanEditMultipleObjects class ColliderPositioner extends Editor { private var just_opened:boolean = true; private var _collider:Collider; private var colPos:Vector3; function OnSceneGUI() { Debug.Log("En metodo Scene GUI"); _collider = (target as ColliderContainer).col; (target as ColliderContainer).col.bounds.center = Handles.PositionHandle(_collider.bounds.center,Quaternion.identity); if(GUI.changed) {EditorUtility.SetDirty(target);} } } The ColliderContainer is simply a script which assigns the gameObject's collider to va public variable called col. It has the @ExecuteInEditMode attribute. For some reason I cannot understand, the line which calls Handles.PositionHandle gives a warning: Assignment to temporary. Manipulating the presented handle in the Unity editor does nothing, but no other errors are issued. Can someone please tell me what I am missing?

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>