Esempio n. 1
0
        private void DisplaySaveTab()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("saveTreeFolder"), new GUIContent("Save folder"));
            if (GUILayout.Button("Find folder"))
            {
                string path = EditorUtility.OpenFolderPanel("save tree location", "Assets", "Assets");
                path = "Assets" + path.Substring(Application.dataPath.Length);
                serializedObject.FindProperty("saveTreeFolder").stringValue = path;
                AssetDatabase.Refresh();
            }
            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.EndHorizontal();
            tree.gameObject.name = EditorGUILayout.TextField("name", tree.gameObject.name);

            if (GUILayout.Button("Save as Prefab"))
            {
#if UNITY_2018_3_OR_NEWER
                SetupLegacyMode();
                SetupLegacyMaterials(tree.gameObject);
                tree.SaveAsPrefab(false, tree.isHDRP);
                SetupHDRPMaterials(tree.gameObject);
                SetupHDRPMode();
#else
                tree.SaveAsPrefab(false, false);
#endif
            }
            EditorGUILayout.EndVertical();
        }
Esempio n. 2
0
    private void DisplaySaveTab()
    {
        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
        if (GUILayout.Button("Bake ambient occlusion"))
        {
            tree.BakeAo();
        }

        EditorGUILayout.BeginHorizontal();
        tree.saveTreeFolder = EditorGUILayout.TextField("Save Folder", tree.saveTreeFolder);
        if (GUILayout.Button("Find folder"))
        {
            string path = EditorUtility.OpenFolderPanel("save tree location", "Assets", "Assets");
            path = "Assets" + path.Substring(Application.dataPath.Length);
            tree.saveTreeFolder = path;
            AssetDatabase.Refresh();
        }

        EditorGUILayout.EndHorizontal();
        tree.gameObject.name = EditorGUILayout.TextField("name", tree.gameObject.name);

        if (GUILayout.Button("Save as Prefab"))
        {
            tree.SaveAsPrefab();
        }
        EditorGUILayout.EndVertical();
    }
Esempio n. 3
0
        private void DisplaySaveTab()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("saveTreeFolder"), new GUIContent("Save folder"));
            if (GUILayout.Button("Find folder"))
            {
                string path = EditorUtility.OpenFolderPanel("save tree location", "Assets", "Assets");
                path = "Assets" + path.Substring(Application.dataPath.Length);
                serializedObject.FindProperty("saveTreeFolder").stringValue = path;
                AssetDatabase.Refresh();
            }


            EditorGUILayout.EndHorizontal();
            tree.gameObject.name = EditorGUILayout.TextField("name", tree.gameObject.name);
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Billboard Settings");
            serializedObject.FindProperty("BB_Brightness").floatValue  = EditorGUILayout.Slider("Brightness", serializedObject.FindProperty("BB_Brightness").floatValue, 0, 3);
            serializedObject.FindProperty("BB_isSingleSided").intValue = GUILayout.Toolbar(serializedObject.FindProperty("BB_isSingleSided").intValue, new string[] { "Double Sided", "Single Sided" });
            serializedObject.FindProperty("BB_hasTopCard").intValue    = GUILayout.Toolbar(serializedObject.FindProperty("BB_hasTopCard").intValue, new string[] { "No Top Card", "Has Top Card" });
            if (tree.BB_hasTopCard == 1)
            {
                serializedObject.FindProperty("BB_TopCardPositon").floatValue = EditorGUILayout.Slider("Top Card Positon", serializedObject.FindProperty("BB_TopCardPositon").floatValue, 0, 1);
            }
            serializedObject.ApplyModifiedProperties();
            EditorGUILayout.EndVertical();
            if (GUILayout.Button("Save as Prefab"))
            {
#if UNITY_2018_3_OR_NEWER
                SetupLegacyMode();
                SetupLegacyMaterials(tree.gameObject);
                tree.SaveAsPrefab(false, tree.isHDRP);
                SetupHDRPMaterials(tree.gameObject);
                SetupHDRPMode();
#else
                tree.SaveAsPrefab(false, false);
#endif
            }
            EditorGUILayout.EndVertical();
        }