C
C#16mo ago
arch_il

❔ I just can't even start to think what has gone wrong.

I get an null reference on tankTwo = new Tank(). I am starting to think I have wrong version of dotnet or something. My version right now is 6.0.401, is there any fault with this one?
13 Replies
arch_il
arch_ilOP16mo ago
I hope it's ok to send project file here
arch_il
arch_ilOP16mo ago
NOTE: I am using MonoGame framework in this project.
phaseshift
phaseshift16mo ago
nobody going to download a .rar. Use $paste, myabe
MODiX
MODiX16mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Zebratic
Zebratic16mo ago
because its an "override", then the global vars are not accessible in the compiled version it overrides an existing function Make the variables accessible by putting it in the correct scope
arch_il
arch_ilOP16mo ago
I would, but too many files for that Could you elaborate?
Zebratic
Zebratic16mo ago
your private GraphicsDeviceManager _graphics; its private, try do the same with the Tank
arch_il
arch_ilOP16mo ago
just add private before tank? I tried that. doesn't seem to change anything
Zebratic
Zebratic16mo ago
else try to initialize it in the global scope aka
public Tank tankOne = new Tank();
public Tank tankOne = new Tank();
Might work, never used XNA before so im not entirely sure
arch_il
arch_ilOP16mo ago
problem is, There are tankOne and tankTwo. tankOne = new Tank(); comes first and works. tankTwo = new Tank(); comes right after it, but doesnt work. tried that. scope doesn't seem to change anything
Zebratic
Zebratic16mo ago
hm good question Not an expert in XNA, but check if you have tankOne defined somewhere else in the code (and tankTwo is not) It might be referencing to some other place by mistake
arch_il
arch_ilOP16mo ago
i checked every difference that could have happened, but they both seem to follow same path
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server