Duplicate Question - http://answers.unity3d.com/questions/1190802/got-a-few-errors-with-my-inventory-any-ideas.html#answer-1190855
Error with classes
 using UnityEngine;
 using System.Collections;
 
 public class InvM_Lab3 : MonoBehaviour {
 
     PF1_IO myIO; 
     LAA_Inventory inv = new LAA_Inventory();  
     LAA_Items tempItems; 
     LAA_Weapons tempWeapons; 
     LAA_Defense tempDefense;  
 
 
 
     enum STATE {none, name, value, att_def, inputItem };
 
     STATE curState = STATE.none;
 
 
     string iName = "";
     int value = 0;
     int att_def = 0;
 
 
 
 
 
     string userInput;
 
 
     void Start () {
         myIO = PF1_IO.pf; 
 
         printInventory();
 
     }
 
 
     void Update () {
 
 
         string sInput = ""; 
 
         int itemp = 0;
 
 
         if(myIO.IsThereInput()){
             sInput = myIO.getString();
 
             itemp = myIO.getInteger();
 
             myIO.ClearPreviousInput();
 
 
         }
 
         switch(curState){
 
         case STATE.name:
             myIO.replaceText("Please enter a name for the item.");
 
             if(sInput != ""){
                 print(sInput);
                 iName = sInput;
                 curState = STATE.value;
             }
             break;
 
         case STATE.value:
             myIO.replaceText("Item Name: " + iName + "\nPlease enter a value for the item.");
 
             if(itemp > 0){
                 value = itemp;
                 itemp = 0;
                 curState = STATE.att_def;
             }
             break;
 
         case STATE.att_def:
             myIO.replaceText("Item Name: " + iName + "\nItem Value: " + value + "\n");
 
         
             if(userInput == "weapon")
                 myIO.appendText("Please enter a weapon for the item.");
         
             else if(userInput == "defense")
                 myIO.appendText("Please enter a defense for the item.");
 
             if(itemp > 0){
                 att_def = itemp;
                 itemp = 0;
                 curState = STATE.inputItem;
             }
             break;
 
         case STATE.inputItem:
 
             if(userInput == "weapon" ){
                 tempWeapons = new LAA_Weapons (value, att_def, iName); 
 
 
                 inv.AddItem(tempWeapons); 
 
                 myIO.replaceText("Your item has been added to your inventory!");
 
                 WouldYouLikeTo(); 
             }
 
             if(userInput == "defense" ){
                 tempDefense = new LAA_Defense (value, att_def, iName);  
 
 
                 inv.AddItem(tempDefense);
 
                 myIO.replaceText("Your item has been added to your inventory!");
 
                 WouldYouLikeTo();
             }
             break;
 
         case STATE.none:
             string temp = sInput.ToLower();
 
 
             if(temp == "weapon" || temp == "defense"){
 
                 print(sInput);
                 userInput = temp;
                 sInput = "";
                 curState = STATE.name;
             }
             else if(temp == "inventory"){
                 printInventory();
                 sInput = "";
             }
             break;
 
         }
 
 
 
 
     }
 
     void printInventory(){
 
 
         myIO.replaceText("You currently have " + inv.getInventoryTotal() + 
             " items in your inventory. Consisting of:\n");
 
 
         for (int i = 0; i < inv.getInventoryTotal (); i++) {
             if (inv.GetAutoAt (i).GetType == "weapons")
                 tempWeapons = (LAA_Weapons)inv.GetAutoAt (i);
             myIO.appendText (tempWeapons.sendInfo ());
         }
 
         for (int i = 0; i < inv.getInventoryTotal (); i++) {
             if (inv.GetAutoAt (i).GetType == "defense")
                 tempWeapons = (LAA_Defense)inv.GetAutoAt (i);
             myIO.appendText (tempDefense.sendInfo()); 
         }
 
         WouldYouLikeTo();
 
 
     }
 
     void WouldYouLikeTo(){
 
 
         myIO.appendText("\n\nWould you like to add another type of \"weapon\" or \"defense\" item to your inventory?" +
             "\n\tOr would you like to see your \"inventory\" again?");
 
         curState = STATE.none;
 
         iName = "";
         value = 0;
         att_def = 0;
         userInput = "";
 
     
 
         tempItems = null;
         tempWeapons = null;
         tempDefense = null;
 
     }
 
 }
 
               using UnityEngine;
 using System.Collections;
 
 public class LAA_Items  {
 
     string Items; 
     string command; 
      
 
     public LAA_Items () {
         Items = ""; 
         command = "";
 
     }
 
     public LAA_Items (string i, string c) {
         Items = i;
         command = c;
 
     }
 
     public void setItems (string i) {
         Items = i;
 
     }
 
     public void setcommand (string c) {
         command = c;
 
     }
 
     public string getItems () {
         return getItems ();
 
     }
 
     public string getcommand () {
         return getcommand ();
 
     }
 }
 
 
 
                 using UnityEngine; using System.Collections; using System.Collections.Generic;
public class LAA_Inventory {
 public List<LAA_Items> WEA$$anonymous$$ = new List<LAA_Items>();
 public LAA_Inventory()
 {
     LAA_Weapons temp = new LAA_Weapons();
     WEA$$anonymous$$.Add(temp);
 }
 public void AddItem(LAA_Items auto)
 {
     WEA$$anonymous$$.Add (auto);
 }
 public LAA_Items GetAutoAt(int i)
 {
     return WEA$$anonymous$$ [i];
 }
 public int getInventoryTotal()
 {
     return WEA$$anonymous$$.Count;
     }
 
                  }
using UnityEngine; using System.Collections;
public class LAA_Weapons : LAA_Items {
 int damage;
 int ammosize;
 public LAA_Weapons()
 {
     this.Type = "Weapon";
     this.Name = "Assualt Rifle";
     this.Price = 750;
     damage = 100;
     ammosize = 25;
 }
 public LAA_Weapons(string n, int p, int d)
 {
     this.Type = "Weapon";
     this.Name = n;
     this.Price = p;
     damage = d;
     ammosize = 0;
 }
 public int getDamage()
 {
     return damage;
 }
 public int getAmmosize()
 {
     return ammosize;
 }
 public string sendInfo ()
 {
     string send;
     send = "\nname: " + this.Name + " price " + this.Price + " damage " + this.damage;
     return send;
 }
 
                  } 
using UnityEngine; using System.Collections;
public class LAA_Defense : LAA_Items {
int strength; int damage;
public LAA_Defense () { this.Type = "Defense"; this.Name = "Armor"; this.Price = 750; strength = 100; damage = 25;
}
public LAA_Defense (string n, int p, int s){
 this.Type = "Defense"; 
 this.Name = n;
 this.Price = p;
 strength = s;
 damage = 0;
 
                  }
public int getStrength() { return strength; }
public int getDamage() { return damage; }
public string sendInfo() { string send; send = "\nname:" + this.Name + "price:" + this.Price + "strength:" + this.strength; return send;
} }
Follow this Question
Related Questions
The content was stopped because a fatal content error has been detected(HELP) 0 Answers
Error 0xc000007b when starting unity.exe 4 Answers
Parsing error CS8205,Parsing Error CS8205 2 Answers
Keeping points tallied 1 Answer
NullReferenceException: Object reference not set to an instance of an object ? 0 Answers
