-
Michael LaFreniere authored
Scripts to be used by shops and modify the player stats (not implemented yet) Can create new weapons by clicking on the menu Assets > create > new weapon
Michael LaFreniere authoredScripts to be used by shops and modify the player stats (not implemented yet) Can create new weapons by clicking on the menu Assets > create > new weapon
CreateWeapon.cs 645 B
using UnityEngine;
using System.Collections;
using UnityEditor;
// ** created by following the Creating An In-Game Shop Unity tutorial **
public class CreateWeapon {
[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
}
}