Hello, guys.
In this section, we're going to create interruptible objects.
And actually, believe me or not, we are halfway there.
There are a few things left to do, and basically our game is ready.
Then we just need to make a menu and basically that's it.
It will be ready.
So you're almost there.
Just keep it on and you'll have yourself your own game.
And this video are going to be very short.
We're going to create a game manager.
We need it to use it like a kind of a hub between objects and scripts.
So in this example, we're going to store information about coins, and if we need to store something
else, we can do it in the game.
Manager So first thing we're going to do is to create a C-sharp script and I'm going to name it as game
manager.
And I was going to have this fancy icon, which is really cool.
Now let's go inside of Game Manager and make it work as a single tone.
Single Singleton allows you to access objects from different, different scripts at any time.
Basically, let's do public static game manager instance and you can use any name but common practices
to just type instance.
Now we can delete start an update until we need it and just create an awake function in the wake.
I'm going to type instance equals to this.
Now because we did this because we made it public static.
We can get access to this again from any script and let's go and try to do that while we're here.
I'm going to create a public int that I'm going to name as coins and I'll save it.
Now let's go back.
I'm going to create an empty object then to be named as game manager.
I can reset, transform.
Close it and drag.
Monitor over here.
And not to go far away.
Let's create an empty object.
I'm going to name it as a coin.
Add the new script with the name Coin.
Let's go inside and just add the start function.
I'll do game manager dot instance, dot coins plus plus.
All right.
I'm going to go back to Unity.
That's duplicated twice.
So we have three coins now, one sell enter play mode.
I can see my coins is equal to three.
So this is how you can get access to game manager from any script.
You just do game manager that instance and do some stuff with it.
Now let's go to next video and make a proper coin.