Unity 편집기에서 구성 가능한 편집 파일 생성

1334 단어
using UnityEditor;

public class PoolManagerEditor {
    [MenuItem("Manager/Creat GameObjectPoolConfig")]
    static void CreatGameObjectPoolList()
    {
        GameObjectPoolList poolList = ScriptableObject.CreateInstance();// 
        string path =@"Assets/Framework/Resources/gameobjectpool.asset";// 
        AssetDatabase.CreateAsset(poolList,path);// 
        AssetDatabase.SaveAssets();// 
    }
}

  
 GameObjectPool 
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
[Serializable]
public class GameObjectPool {
   [SerializeField]// , Unity 
    private string name;
    [SerializeField]
    private GameObject prefab;
    [SerializeField]
    private int maxAmount;
    [NonSerialized]
    private List goList = new List();
	
}

  
GameObjectPoolList 
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
[Serializable]
public class GameObjectPoolList : ScriptableObject {
    public List poolList;
}

  
전재 대상:https://www.cnblogs.com/trlq/p/7482478.html

좋은 웹페이지 즐겨찾기