So I have this weird question and I’m struggling to find a solution to it because I am not a programmer.
To keep it simple, let’s imagine a top-down view game where you can build some different buildings selected from your HUD. These building types would be different classes, all derived from ABuilding class. In ABuildings class there would be a variable called ‘Price’ and it would indicate the amount of money the player must have in order to build the building. So each building type class would have a ‘Price’ variable and that could be set to a default value individually. When the player clicks a building on his HUD, the game would check if he has enough money to proceed, and if so, the building would be allowed to be placed.
So here is my question. When the player clicks let’s say ‘BarackBuilding’ the default value of the Price variable of that class needs to be checked in order to make the calculations of checking the player’s money. But that class is not existing anywhere in the level, it is only created in the Editor, so in my understanding there is no way to get a reference to it and read its stored values.
I am aware that the building could be spawned hidden and then only set it to visible when the transaction is actually happened but I was wondering if the method described above could work (probably not tho:P).
Thanks in advance!