Ejemplo n.º 1
0
        /// <summary>
        /// Selects the component's scene object and focuses on the specific field in the inspector, if the inspector
        /// window is open.
        /// </summary>
        private void FocusOnField()
        {
            if (headers != null && headers.Count > 0)
            {
                if (headers.Count == 1)
                {
                    if (Selection.SceneObject != headers[0].obj)
                    {
                        Selection.SceneObject = headers[0].obj;
                    }
                }
                else
                {
                    List <SceneObject> objs = new List <SceneObject>();
                    foreach (var header in headers)
                    {
                        if (header.obj != null)
                        {
                            objs.Add(header.obj);
                        }
                    }

                    Selection.SceneObjects = objs.ToArray();
                }

                if (!string.IsNullOrEmpty(fieldPath))
                {
                    InspectorWindow inspectorWindow = EditorWindow.GetWindow <InspectorWindow>();
                    inspectorWindow?.FocusOnField(headers[0].obj.UUID, fieldPath);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Selects the component's scene object and focuses on the specific field in the inspector, if the inspector
        /// window is open.
        /// </summary>
        private void FocusOnField()
        {
            SceneObject so = obj.SceneObject;

            if (so != null)
            {
                if (Selection.SceneObject != so)
                {
                    Selection.SceneObject = so;
                }

                if (!string.IsNullOrEmpty(fieldPath))
                {
                    InspectorWindow inspectorWindow = EditorWindow.GetWindow <InspectorWindow>();
                    inspectorWindow?.FocusOnField(obj.UUID, fieldPath);
                }
            }
        }