Hey there. Pretty new dev here, relatively rusty.
I have a public abstract class named ‘Item’. The following code is a simplified version of it:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[System.Serializable]//Base Item class
public abstract class Item
{
protected string ItemName;//Has the item's name
protected string ItemTitle;//Has the item's type
protected int ItemNum;//Has the item's special number
protected string ItemDesc;//Has the item's description
protected float Energy;//Has the item's energy level
protected int HP;//Has the item's current HP
protected int MaxHP;//Has the item's max HP
protected int ShieldHP;//Has the item's shield HP
protected Augment Augment;//Has the item's possible augment
public Item (string ItemName,string ItemTitle,int ItemNum,string ItemDesc, float Energy, int MaxHP)//Creation without augment
{
this.ItemName = ItemName;
this.ItemTitle = ItemTitle;
this.ItemNum = ItemNum;
this.ItemDesc = ItemDesc;
this.Energy = Energy;
this.HP = MaxHP;
this.MaxHP = MaxHP;
this.ShieldHP = 0;
}
//Following are basic get/set functions and what not
}
I have GameObjects with scripts attached to them, which are relatively empty except for the public Item variable:
using UnityEngine;
using System.Collections;
public class Stats : MonoBehaviour
{
public Item MyItem;
}
However, when the script is attached to GameObjects in my scene, the inspector doesn’t show the public MyItem variable. What gives? It’s not a compiling error, because when I create simpler public variables (Like public int MyInt) they do show up.
I am feeling like I am missing something pretty basic here. Please help!
Thanks in advance.