32
1
using UnityEngine;
2
using UnityEditor;
3
4
public class CreateWeaponWizard : ScriptableWizard
5
{
6
public string weaponName = "Big Gun";
7
public string tag = "Weapon";
8
public int power;
9
public Texture2D graphic;
10
[MenuItem("Unatcolium/Create Weapon")]
11
static void CreateWizzard()
12
{
13
DisplayWizard("Create your weapon", "Create", "Update");
14
}
15
16
private void OnWizardCreate()
17
{
18
GameObject weapon = new GameObject(weaponName);
19
weapon.tag = tag;
20
Weapon weaponComponent = weapon.AddComponent();
21
weaponComponent.weaponName = weaponName;
22
weaponComponent.power = power;
23
weaponComponent.graphic = graphic;
24
}
25
}
26
27
public class Weapon : MonoBehaviour
28
{
29
public string weaponName;
30
public int power;
31
public Texture2D graphic;
32
}
Cached Result