- Home /
Question by
IMTRIGGERHAPPY9 · Feb 05, 2012 at 09:17 PM ·
guieditorguidropdownfoldout
EditorGUI.ObjectField placed right below EditorGUI.Foldout?
so i have a set of foldouts and i want to get the position in the inspector of one of the fold outs so i can place my object field accordingly is there a way of getting the position in the inspector of the foldout?
Here is my current code( i was experimenting with tower1DropDown.position.width, but it isn't working):
humanDropDown = EditorGUILayout.Foldout(humanDropDown,"Humans");
if(humanDropDown){
EditorGUI.indentLevel = 1;
hTowers = EditorGUILayout.Foldout(hTowers,"Towers");
if(hTowers){
EditorGUI.indentLevel = 2;
tower1DropDown = EditorGUILayout.Foldout(tower1DropDown,"Tower 1");
if(tower1DropDown){
target.tower1CostH = EditorGUILayout.IntField("Tower 1 Cost: ",target.tower1CostH);
target.tower1GhostH = EditorGUI.ObjectField(Rect(tower1DropDown.position.width,0,150,60),target.tower1GhostH,GameObject);
}
Comment
Answer by Aeless · Feb 06, 2012 at 01:15 PM
http://unity3d.com/support/documentation/ScriptReference/GUILayoutUtility.GetLastRect.html
wanna take a look at this maybe ?