I have a problem that i cant access the objectvariables outside this onClick function. I get the error: NullReferenceException: Object reference not set to an instance of an object. If i try to access these objectvariables inside the update function in the same class, its works fine.
In the objectvariables i set value = 20. As you can see in the code, inside the craftbuilding() function i set the value to 23. But this doesnt update the objectvariable. This also means that i get errors for buildingSelected and itemsInInventory since i cant access them inside this function.
Any help would be appreciated!