Advertisement
AnomalousUnderdog

Creating ScriptableObjects

Aug 2nd, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1.             string newName = "NewHitscanWeapon";
  2.             HitScanWeaponDefinition newDef = ScriptableObject.CreateInstance<HitScanWeaponDefinition>(); // HitScanWeaponDefinition is my ScriptableObject class
  3.             newDef.name = newName;
  4.             AssetDatabase.CreateAsset(newDef, _lastAssetPath + "/" + newName + ".asset"); // _lastAssetPath's value is the path of the last folder the user clicked on in the Project View
  5.             Selection.activeObject = newDef;
  6.             EditorUtility.FocusProjectWindow();
  7.             Debug.Log("Created new hitscan weapon file at: " + AssetDatabase.GetAssetPath(newDef));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement