Bassicly whenever the pinball goes down to low, it hits a trigger (the deadzone) that resets the position of the ball, and respawns all the coins. Now all the coins are childs of a parent called CoinParent that has a script that handles detecting the amount of coins gotten, and also handling respawning all the coins. Now this all works totally fine IF i havent changed scene. BUT whenever i change scene, any refference in the CoinsParent script (CountCoins) to: transform, or gameObject will give me the following error:
MissingReferenceException: The object of type ‘countCoins’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
Now it get’s weirder. Because even if the CoinParent GameObject is not active, when the ball hits the deadzone and all the coins are supposed to reset, it gives me the excact same error, and that error when i click on it, takes me to the same place that i was taken when the CoinParent Gameobject WAS active. It’s like it litteraly doesn’t care if it’s active or not.
I really have no idea how to fix this. it says the countCoin script is destroyed but it’s clearly executing. also - yes - of course i have checked if either the gameObject or the transform are null in the script but that ALSO gives me the error, cause the script simply can’t handle any refference to one of those two