void myConfigListAdd(ReorderableList reoList)
    {
        string path = "Assets/ChunkConfigs";

        chunkArray.arraySize++;

        if (!AssetDatabase.IsValidFolder(path))
        {
            AssetDatabase.CreateFolder("Assets", "ChunkConfigs");
        }

        ChunkSetUp chunk = new ChunkSetUp();

        string assetPath = path + "/MyNewConfig.asset";

        assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath);
        AssetDatabase.CreateAsset(chunk, assetPath);

        //levelManager.chunkConfigList.Add(chunk);

        chunkArray.GetArrayElementAtIndex(chunkArray.arraySize - 1).objectReferenceValue = chunk;

        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();

        EditorGUIUtility.PingObject(chunk);
    }
 private void OnSelectionChange()
 {
     if (Selection.activeObject is ChunkSetUp)
     {
         currentChunk = Selection.activeObject as ChunkSetUp;
         Repaint();
     }
 }
    public void Init(ChunkSetUp assetTarget)
    {
        minSize         = new Vector2(500, 100);
        virtualPosition = Vector2.zero;

        currentChunk = assetTarget;

        Selection.selectionChanged += OnSelectionChange;

        separator = EditorGUIUtility.Load("Assets/Materials/Line1.png") as Texture;

        Undo.undoRedoPerformed += MyUndoCallBack;

        Show();
    }
示例#4
0
    private void OnEnable()
    {
        targetChunk = target as ChunkSetUp;
        chunks      = new ChunkSetUp[targets.Length];
        for (int i = 0; i < targets.Length; i++)
        {
            chunks[i] = targets[i] as ChunkSetUp;
        }

        ChunkEditorWindow[] cew = Resources.FindObjectsOfTypeAll(typeof(ChunkEditorWindow)) as ChunkEditorWindow[];
        if (cew.Length != 0)
        {
            for (int i = 0; i < cew.Length; i++)
            {
                cew[i].Focus();
            }
        }
    }