It looks like you're new here. If you want to get involved, click one of these buttons!
Suppose I earn some coins in one scene. The no. of coins is stored in a variable called coinNumber. How to show the same number of coins in other scenes? No matter which scene I collect coins in, it should show the same value in all scenes.
Comments
Try look up the function: DontDestroyOnLoad() this will keep the object when loading to a new scene without resetting it's different variables.
What i like to do is to create a non MonoBehaviour Script ( This Script is not attached to any GameObject since it is a non MonoBehaviour) where you declare the variables as static. You can then simply acces any of its variables by calling the static class name from any of your scenes. Example:
public static GlobalClass
{
public static int coins;
}
Acces the variable with:
GlobalClass.coins