Last active
January 18, 2024 10:00
-
-
Save johnsoncodehk/03d3871a1453d795162a6dbf01f904c3 to your computer and use it in GitHub Desktop.
Create script from template in project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Not support of 2019.1.0f1 | |
static void CreateScriptAsset(string templatePath, string destName) { | |
#if UNITY_2019_1_OR_NEWER | |
UnityEditor.ProjectWindowUtil.CreateScriptAssetFromTemplateFile(templatePath, destName); | |
#else | |
typeof(UnityEditor.ProjectWindowUtil) | |
.GetMethod("CreateScriptAsset", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic) | |
.Invoke(null, new object[] { templatePath, destName }); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment