Ejemplo n.º 1
0
    void setMode()
    {
        GameObject pObj;

        switch (sm)
        {
        case sMode.REPLACE:
            pObj = (GameObject)EditorGUI.ObjectField(EditorGUILayout.GetControlRect(), "Replace with : ", obj, typeof(GameObject), true);
            if (pObj != null && (PrefabUtility.GetPrefabType(pObj) == PrefabType.Prefab || PrefabUtility.GetPrefabType(pObj) == PrefabType.PrefabInstance || PrefabUtility.GetPrefabType(pObj) == PrefabType.ModelPrefab))
            {
                obj = pObj;
            }
            else
            {
                obj = null;
            }
            break;

        case sMode.FILTER:
            break;

        case sMode.ADD_AS_CHILD:
            break;

        case sMode.RENAME:
            rm = (renameMode)EditorGUI.EnumPopup(EditorGUILayout.GetControlRect(), "Rename Mode:", rm);
            switch (rm)
            {
            case renameMode.NAME_NUMBER:
                newName = EditorGUILayout.TextField("Name:", newName);
                break;

            case renameMode.NUMBER_FROM:
                newName = EditorGUILayout.TextField("Name:", newName);
                num     = EditorGUILayout.IntField("Starting Number:", num);
                break;

            case renameMode.SAME_NAME:
                newName = EditorGUILayout.TextField("Name:", newName);
                break;
            }
            break;

        case sMode.SET_TO_SINGLE_PREFAB:
            pObj = (GameObject)EditorGUI.ObjectField(EditorGUILayout.GetControlRect(), "Connect to : ", obj, typeof(GameObject), true);
            if (pObj != null && PrefabUtility.GetPrefabType(pObj) == PrefabType.Prefab)
            {
                obj = pObj;
            }
            else
            {
                obj = null;
            }
            break;
        }
    }
Ejemplo n.º 2
0
	void setMode() {
		GameObject pObj;
		switch (sm) {
			case sMode.REPLACE:
				pObj = (GameObject) EditorGUI.ObjectField(EditorGUILayout.GetControlRect(),"Replace with : ",obj,typeof(GameObject), true);
				if (pObj != null && (PrefabUtility.GetPrefabType(pObj) == PrefabType.Prefab || PrefabUtility.GetPrefabType(pObj) == PrefabType.PrefabInstance || PrefabUtility.GetPrefabType(pObj) == PrefabType.ModelPrefab)) {
					obj = pObj;
				} else {
					obj = null;
				}
				break;
			case sMode.FILTER:
				break;
			case sMode.ADD_AS_CHILD:
				break;
			case sMode.RENAME:
				rm = (renameMode) EditorGUI.EnumPopup ( EditorGUILayout.GetControlRect(), "Rename Mode:", rm);
				switch (rm) {
					case renameMode.NAME_NUMBER:
						newName = EditorGUILayout.TextField ("Name:", newName);
						break;
					case renameMode.NUMBER_FROM:
						newName = EditorGUILayout.TextField ("Name:", newName);
						num = EditorGUILayout.IntField ("Starting Number:", num);
						break;
					case renameMode.SAME_NAME:
						newName = EditorGUILayout.TextField ("Name:", newName);
						break;
				}
				break;
			case sMode.SET_TO_SINGLE_PREFAB:
				pObj = (GameObject) EditorGUI.ObjectField(EditorGUILayout.GetControlRect(),"Connect to : ",obj,typeof(GameObject), true);
				if (pObj != null && PrefabUtility.GetPrefabType(pObj) == PrefabType.Prefab) {
					obj = pObj;
				} else {
					obj = null;
				}
				break;
		}
	}