OnWillCreateAsset() private static method

private static OnWillCreateAsset ( string path ) : void
path string
return void
コード例 #1
0
        internal static Object CreateScriptAssetWithContent(string pathName, string templateContent)
        {
            AssetModificationProcessorInternal.OnWillCreateAsset(pathName);

            templateContent = SetLineEndings(templateContent, EditorSettings.lineEndingsForNewScripts);

            string fullPath = Path.GetFullPath(pathName);

            File.WriteAllText(fullPath, templateContent);

            // Import the asset
            AssetDatabase.ImportAsset(pathName);

            return(AssetDatabase.LoadAssetAtPath(pathName, typeof(Object)));
        }