Skip to content

Instantly share code, notes, and snippets.

@johnsoncodehk
Last active January 18, 2024 10:00
Show Gist options
  • Save johnsoncodehk/03d3871a1453d795162a6dbf01f904c3 to your computer and use it in GitHub Desktop.
Save johnsoncodehk/03d3871a1453d795162a6dbf01f904c3 to your computer and use it in GitHub Desktop.
Create script from template in project
static void CreateScriptAsset(string templatePath, string destName) {
typeof(UnityEditor.ProjectWindowUtil)
.GetMethod("CreateScriptAsset", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
.Invoke(null, new object[] { templatePath, destName });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment