示例#1
0
    public override void OnInspectorGUI()
    {
        if (m_activeEntity == null)
        {
            SetActiveObject();
        }

        if (GUILayout.Button("Extract Data"))
        {
            string path = EditorUtility.OpenFolderPanel("Set Save Path", "/Data/", "");

            using (StreamWriter writer = new StreamWriter(path + "/EntityData.txt", false))
            {
                string entityData = m_activeEntity.SerializedEntityData();
                writer.Write(entityData);
            }

            using (StreamWriter writer = new StreamWriter(path + "/EnemyData.txt", false))
            {
                string enemyData = m_activeEntity.SerializedEnemyData();
                writer.Write(enemyData);
            }

            AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
        }

        DrawDefaultInspector();
    }