Can't destroy Transform component of 'buildningBack(Clone)'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
How can i disobey the “Destroying the transform component is not allowed.”-rule
its possible that you have this iconBackCurrent referenced as Transform type at the top of the script?
for destroy to work, you have to give it the gameobject as opposed to one of the components, on a gameobject.
either declare it as a gameobject type rather than a transform, or try ammending the destroy to the following to see if it works.
Destroy(iconBackCurrent.gameObject);
see how it goes
NB : but, if its a public reference in a slot in the inspector and you change the referenced type, you will have to drag it back into the inspector as you will get errors otherwise…
What are “iconUpgradeCurrent”, “iconSellCurrent”, and “iconBackCurrent”. According to your error it sounds like they’re not GameObjects…in which case you can’t use Destroy…there is no way to disobey that.