- Home /
Question by
Forte259 · Mar 31, 2014 at 05:40 PM ·
c#errornullreferenceexeption
NullReferenceException: Object reference not set to an instance of an object
Hey there, so the title says the problem I have, I tried everything I could possible imagine and see arround other awnsers and topics, with no luck to fix my problem.
So here's my code (not all of it but where it says I have the problem)
public class SlotInv {
public int[] ItemIndex;
public int[] ItemAmount;
public SlotInv Inventory;
void Awake () {
Inventory.ItemIndex = new int[40];
Inventory.ItemAmount = new int[40];
The problem is on the Awake function I think, so I hope someone can help me.
Thanks in advance!
Comment
Best Answer
Answer by perchik · Mar 31, 2014 at 05:44 PM
void Awake () {
Inventory = new SlotInv();
How could I forgot that... Thank you very much for your help! :P
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
not all lines of code running c# 0 Answers