public T GetEditor <T>(FObject obj) where T : FEditor
        {
            if (_editorHash == null)
            {
                Refresh();
//				editorHash = new Dictionary<int, CEditor>();
//
//				int numEditors = editorHashKeys.Count;
//
//				for( int i = 0; i != numEditors; ++i )
//				{
//					editorHash.Add( editorHashKeys[i], editorHashValues[i] );
//				}
            }

            if (obj == null)
            {
                Debug.Log("obj is null");
            }

            if (_editorHash.ContainsKey(obj.GetInstanceID()))
            {
                //T editor = editorHash[obj.GetInstanceID()];
                //editor.Init( editor
                //				Debug.LogWarning ("Contains key! " + obj.GetInstanceID() + " selected? " + editorHash[obj.GetInstanceID()].IsSelected() + " id " + editorHash[obj.GetInstanceID()].GetInstanceID() );
                return((T)_editorHash[obj.GetInstanceID()]);
            }


            Type[] allTypes = typeof(FEditor).Assembly.GetTypes();

            Type editorType = typeof(T);

            Type bestEditorType = editorType;

            Type objType = obj.GetType();

            Type closestObjType = objType;

            foreach (Type type in allTypes)
            {
                if (!type.IsSubclassOf(editorType))
                {
                    continue;
                }

                object[] attributes = type.GetCustomAttributes(false);

                foreach (object o in attributes)
                {
                    if (!(o is FEditorAttribute))
                    {
                        continue;
                    }

                    FEditorAttribute editorAttribute = (FEditorAttribute)o;
                    if (editorAttribute.type == objType)
                    {
                        bestEditorType = type;
                        break;
                    }

                    if (editorAttribute.type.IsAssignableFrom(objType) && editorAttribute.type.IsSubclassOf(closestObjType))
                    {
                        bestEditorType = type;
                        closestObjType = editorAttribute.type;
                    }
                }
            }
            T editor = (T)Editor.CreateInstance(bestEditorType);

            //			editor.Init( this, obj );

            _editorHash.Add(obj.GetInstanceID(), editor);
            _editorHashKeys.Add(obj.GetInstanceID());
            _editorHashValues.Add(editor);
#if FLUX_DEBUG
            Debug.LogWarning("Creating new.. " + obj.GetInstanceID() + " selected? " + _editorHash[obj.GetInstanceID()].IsSelected() + " id " + _editorHash[obj.GetInstanceID()].GetInstanceID() + " name : " + obj.name);
#endif
            return(editor);
        }
        public T GetEditor <T>(FObject obj) where T : FEditor
        {
            if (_editorHash == null)
            {
                Refresh();
            }

            if (obj == null)
            {
                Debug.Log("obj is null");
            }

            if (_editorHash.ContainsKey(obj.GetInstanceID()))
            {
                return((T)_editorHash[obj.GetInstanceID()]);
            }


            Type[] allTypes = typeof(FEditor).Assembly.GetTypes();

            Type editorType = typeof(T);

            Type bestEditorType = editorType;

            Type objType = obj.GetType();

            Type closestObjType = objType;

            foreach (Type type in allTypes)
            {
                if (!type.IsSubclassOf(editorType))
                {
                    continue;
                }

                object[] attributes = type.GetCustomAttributes(false);

                foreach (object o in attributes)
                {
                    if (!(o is FEditorAttribute))
                    {
                        continue;
                    }

                    FEditorAttribute editorAttribute = (FEditorAttribute)o;
                    if (editorAttribute.type == objType)
                    {
                        bestEditorType = type;
                        break;
                    }

                    if (editorAttribute.type.IsAssignableFrom(objType) && editorAttribute.type.IsSubclassOf(closestObjType))
                    {
                        bestEditorType = type;
                        closestObjType = editorAttribute.type;
                    }
                }
            }
            T editor = (T)Editor.CreateInstance(bestEditorType);

            _editorHash.Add(obj.GetInstanceID(), editor);
            _editorHashKeys.Add(obj.GetInstanceID());
            _editorHashValues.Add(editor);

            return(editor);
        }