C
C#14mo ago
MRW419

I'm making a grid for a tower defense game and I keep getting these errors. Does anyone know why?

No description
No description
7 Replies
SinFluxx
SinFluxx14mo ago
You've named your dictionary gameObjects and you've also named your second parameter in your Add method, which is of type GameObject, gameObjects So when you reference gameObjects inside your Add method, it's referring to the GameObject parameter, rather than your dictionary
MRW419
MRW419OP14mo ago
So should I cahnge one of them to a different name?
SinFluxx
SinFluxx14mo ago
Yes, best to name things differently to avoid confusion like this
MRW419
MRW419OP14mo ago
Got it thank you
MRW419
MRW419OP14mo ago
@SinFluxx Sorry to @ you again but do know why my grids is not doing what it's needed on line 28
No description
No description
SinFluxx
SinFluxx14mo ago
Does your Grids class have a WorldToGrid method?
MRW419
MRW419OP14mo ago
Oh, so while watching a class video. I just realized I had to put that in the my grid code on my own

Did you find this page helpful?