I have an array in c sharp that I want to inherit from a class in another script. How would I write this? Help
Here’s the array:
using UnityEngine;
using System.Collections;
public class Inventory : MonoBehaviour {
public int[] weapons = new int[0];
void OnGUI(){
}
}
Here’s the array:
sing UnityEngine;
using System.Collections;
public class Weapon : MonoBehaviour {
public class weapons{
public string name;
public string description;
public float damage;
public float speed;
enum Rarity{
uncommon,
common,
rare,
epic
}
}
}
Make sure to have all of this inside of one script
public class Inventory : MonoBehaviour {
public Weapon[] weapons;
void OnGUI(){
}
}
[System.Serializable]
public class Weapon {
public string name;
public string description;
public float damage;
public float speed;
enum Rarity{
uncommon,
common,
rare,
epic
}
}