Beispiel #1
0
        public static bool OnOpenAsset(int instanceID, int line)
        {
            LevelEditorResourceList myAsset = EditorUtility.InstanceIDToObject(instanceID) as LevelEditorResourceList;

            if (myAsset != null)
            {
                OpenAsset(myAsset);
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        private void OnSelectionChange()
        {
            if (!initialized)
            {
                return;
            }

            LevelEditorResourceList myAsset = Selection.activeObject as LevelEditorResourceList;

            if (myAsset != null && myAsset != asset)
            {
                asset = myAsset;
                treeView.TreeModel.SetData(GetData());
                treeView.Reload();
            }
        }
Beispiel #3
0
        private void CreateResources()
        {
            resources = ScriptableObject.CreateInstance <LevelEditorResourceList>();

            cube     = GameObject.CreatePrimitive(PrimitiveType.Cube);
            sphere   = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            capsule  = GameObject.CreatePrimitive(PrimitiveType.Capsule);
            cylinder = GameObject.CreatePrimitive(PrimitiveType.Cylinder);

            sceneObjects.Add(cube);
            sceneObjects.Add(sphere);
            sceneObjects.Add(capsule);
            sceneObjects.Add(cylinder);

            LevelEditorResource cubeResource = new LevelEditorResource
            {
                Name  = "Cube",
                Asset = cube,
                ID    = "cube"
            };

            LevelEditorResource sphereResource = new LevelEditorResource
            {
                Name  = "Sphere",
                Asset = sphere,
                ID    = "sphere"
            };

            LevelEditorResource capsuleResource = new LevelEditorResource
            {
                Name  = "Capsule",
                Asset = capsule,
                ID    = "capsule"
            };

            LevelEditorResource cylinderResource = new LevelEditorResource
            {
                Name  = "Cylinder",
                Asset = cylinder,
                ID    = "cylinder"
            };

            resources.AddResource(cubeResource);
            resources.AddResource(sphereResource);
            resources.AddResource(capsuleResource);
            resources.AddResource(cylinderResource);
        }
Beispiel #4
0
 public void SetAsset(LevelEditorResourceList asset)
 {
     this.asset   = asset;
     titleContent = new GUIContent(asset == null ? "Resource List" : asset.name);
     initialized  = false;
 }
Beispiel #5
0
        public static void OpenAsset(LevelEditorResourceList asset)
        {
            LevelEditorResourcesWindow window = GetWindow();

            window.SetAsset(asset);
        }