Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string newName = "NewHitscanWeapon";
- HitScanWeaponDefinition newDef = ScriptableObject.CreateInstance<HitScanWeaponDefinition>(); // HitScanWeaponDefinition is my ScriptableObject class
- newDef.name = newName;
- AssetDatabase.CreateAsset(newDef, _lastAssetPath + "/" + newName + ".asset"); // _lastAssetPath's value is the path of the last folder the user clicked on in the Project View
- Selection.activeObject = newDef;
- EditorUtility.FocusProjectWindow();
- Debug.Log("Created new hitscan weapon file at: " + AssetDatabase.GetAssetPath(newDef));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement