Exemplo n.º 1
0
        private ObjectInspector FindObjectInspector()
        {
            List <string> assembliesToCheck = new List <string> {
                "Assembly-CSharp-Editor", "Assembly-CSharp-Editor-firstpass", "Assembly-UnityScript-Editor", "Assembly-UnityScript-Editor-firstpass"
            };
            string assetPath = AssetDatabase.GetAssetPath(target);

            Assembly[] referencedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
            for (int i = 0; i < referencedAssemblies.Length; ++i)
            {
                if (!assembliesToCheck.Contains(referencedAssemblies[i].GetName().Name))
                {
                    continue;
                }
                foreach (var type in referencedAssemblies[i].GetTypes())
                {
                    if (!type.IsSubclassOf(typeof(ObjectInspector)))
                    {
                        continue;
                    }
                    ObjectInspector objectInspector = (ObjectInspector)Activator.CreateInstance(type);
                    if (objectInspector.IsValid(assetPath))
                    {
                        objectInspector.target = target;
                        return(objectInspector);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
 private void OnEnable()
 {
     objectInspector = FindObjectInspector ();
     if(objectInspector != null) {
         objectInspector.serializedObject = serializedObject;
         objectInspector.target = target;
         objectInspector.OnEnable();
     }
 }
Exemplo n.º 3
0
 private void OnEnable()
 {
     objectInspector = FindObjectInspector();
     if (objectInspector != null)
     {
         objectInspector.serializedObject = serializedObject;
         objectInspector.target           = target;
         objectInspector.OnEnable();
     }
 }