UnityEditor.ProjectWindowUtil.CreateAsset C# (CSharp) Method

CreateAsset() public static method

public static CreateAsset ( Object asset, string pathName ) : void
asset Object
pathName string
return void
        public static void CreateAsset(Object asset, string pathName)
        {
            StartNameEditingIfProjectWindowExists(asset.GetInstanceID(), ScriptableObject.CreateInstance<DoCreateNewAsset>(), pathName, AssetPreview.GetMiniThumbnail(asset), null);
        }

Usage Example

Exemplo n.º 1
0
        public void OnGUI()
        {
            EditorGUIUtility.hierarchyMode = true;

            lightmapSettings.Update();

            m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);

            EditorGUILayout.PropertyField(m_LightingSettingsAsset);

            EditorGUILayout.Space();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(Styles.newLightingSettings, GUILayout.Width(170)))
            {
                var ls = new LightingSettings();
                ls.name = "New Lighting Settings";
                Undo.RecordObject(m_LightmapSettings.targetObject, "New Lighting Settings");
                Lightmapping.lightingSettingsInternal = ls;
                ProjectWindowUtil.CreateAsset(ls, (ls.name + ".lighting"));
            }

            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            m_BakeSettings.OnGUI();
            WorkflowSettingsGUI();

            EditorGUILayout.EndScrollView();
            EditorGUILayout.Space();

            lightmapSettings.ApplyModifiedProperties();
        }
All Usage Examples Of UnityEditor.ProjectWindowUtil::CreateAsset