Hey there! I’m trying to create script asset files via a Custom Editor but am not having much luck. I’ve tried writing a ScriptableObject to a file but it just seems to write YAML and I can’t apply that to an existing object.
Has anyone been able to create Script asset files via a custom editor and, if so, what’s the best way to accomplish this? Could it be as simple as just writing to a file with a .cs extension?
Please post the code in code tags rather that attaching a file to your post.
The most straightforwards way is to write the script text to a file with the .cs extension, and then calling AssetDatabase.Refresh to trigger the file getting imported and compiled.