void OnGUI()
    {
        tempObject = (GameObject)EditorGUILayout.ObjectField(tempObject, typeof(GameObject), true);

        if (GUILayout.Button("Create a new interchangable in current List"))
        {
            prefabInterchangableSerializer.prefabInterchangableList.Add(InstantiatorUtil.ParsePrefabInfoFromGameObject(collectGameObjectPrefabDependency(tempObject)));

            ClearObjectField();
        }

        if (GUILayout.Button("Load"))
        {
            prefabInterchangableSerializer = Load(Path.Combine(Application.dataPath, "PrefabInterChangable.xml"));
        }

        if (GUILayout.Button("Save"))
        {
            Save(Path.Combine(Application.dataPath, "PrefabInterChangable.xml"));
        }

        if (initialized)
        {
            foreach (PrefabInfo pi in prefabInterchangableSerializer.prefabInterchangableList)
            {
                EditorGUILayout.BeginHorizontal();
                pi.prefabName = EditorGUILayout.TextField(pi.prefabName);
                pi.assetPath  = EditorGUILayout.TextField(pi.assetPath);
                EditorGUILayout.EndHorizontal();
            }
        }
    }
Ejemplo n.º 2
0
    private void initialize()
    {
        buildingGroup = new List <GameObject>();

        for (int i = 0; i < ParentTransform.childCount; i++)
        {
            buildingGroup.Add(ParentTransform.GetChild(i).gameObject);
        }

        // Load Color Data
        currentMaterialColorSerializer = loadColorData();

        // Load Prefab Data
        currentPrefabInterchangable = loadPrefabInterchangableData();
    }
 void Awake()
 {
     prefabInterchangableSerializer = new PrefabInterchangable();
     initialized = true;
 }