using UnityEngine; using System.Collections; #if UNITY_EDITOR using UnityEditor; #endif // ** created by following the Creating An In-Game Shop Unity tutorial ** public class CreateWeapon { #if UNITY_EDITOR [MenuItem("Assets/Create/New Weapon")] // can create this by going assets > create > new weapon public static void MakeWeapon() { WeaponStats weapon = ScriptableObject.CreateInstance<WeaponStats>(); AssetDatabase.CreateAsset(weapon, "Assets/NewWeapon.asset"); // we can edit fields in inspector AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = weapon; // able to highlight it } #endif }