if (towerPrefabToBuild != null)
{
//If there is no tower in that slot and we have enough gold to
build the selected tower:
if (!towers.ContainsKey(highlighter.position) && gold >=
towerPrefabToBuild.goldCost)
{
BuildTower(towerPrefabToBuild,highlighter.position);
}
}
there is more places where “gold” appear but this one above is the first one i think.
Does the book have a download location for the files? You could also use your phone to take photos of the code from the book and paste it here. Just search the code you’ve written for the word “gold” to find the first occurrence, hopefully the declaration.
Ok, but i can’t share whole code. It has around 350 lines and I’am writing in a different language so it will be very confusing to you. The thing is the “gold” variable is not declared and I am getting an error.
So somebody have to have that book at home or maybe somebody was doing it not long ago??
Can you elaborate, in a different language? Are you not coding in C# and English? Does the book not have a download location for the files? Did you search your file for the first occurrence? There is a good chance no one reading this post will have the book.
The issue about my previous post was about my wrong “interpretation” of some part of the book. But here in this post the main issue is the gold variable is missing in the book!! which is the shame for the author… I also spotted other small issues like wrong figure image or a single word (but not in the code).
Thank you for your help anyway because I didn’t think before to find the book files on the internet.