- Home /
Question by
tutiplain1 · Feb 23, 2013 at 01:44 AM ·
collidercustom-inspectorhandles
Simple Custom editor using Handles.PositionHandle does nothing. Please help!
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?
Comment
Your answer
Follow this Question
Related Questions
Internal collisions 1 Answer
Draggable Nodes in Editor? 1 Answer
How do I make editable nodes? 1 Answer
Object wont move after collision with more than one point 1 Answer