The basics of Brackeys ended today with a playable program.

1. Animation event loads the next level

You can use events in an Animation. For example, load the next level after a few seconds of animation. This can be done in the Add Event in the Animation Panel. We add an event some time after the animation has played.

But where do I find the event that loads the next level?

  • The answer is Script. We’re going to add a Script component to the Object that the animation is on to write our function.

And then you can find the function that we wrote in the Add Event. (After pulling out the list, you can keyboard search, otherwise it is too troublesome to find one by one). (After the event is created, it does not exist as a keyframe, but as a small vertical bar above the timeline, which is not easy to find.)

However, we don’t have many levels yet, and we can test them in the next step, but we will introduce the following building setting first.

1.1 building setting

Go to File->Building Setting. You can see the following screen, notice the red part:This is called the building index, and it starts at 0 and adds + 1 for each level. We can use this to automatically enter the next level by giving index + 1 each time, as shown in the code:

Create multiple levels

If we just copy the level and change it, then a lot of times if we want to change the style of the main character and so on, we have to change each level card, which is very troublesome. So we’re going to use prefabs. We drag objects that may need to be changed later into the Asset folder and create a new Prefabs folder to put in. And then let’s copy our Scene.

3. Final image

After clearance, of course, there must be a picture. We also use Scene here. So let’s create a new Scene. File->New Scene or CTRL +N. Just like when we created the UI, we used a Panel to draw. In addition to some text, we can also add a button that can be clicked to exit the game.

By the way, the f key focus is past tense, now double click Object to focus.

So how do you bind events? Very simple, button has an OnClick:

Events are also naturally written in Script, and notice that button here can specify which object to look for functions from. So we can write functions on other objects and use them on OnClick. Here we write the Script on the outer panel. Then drag it onto OnClick.



The script for ending the game is simpler:The results are as follows:

4. Initial menu

Initial menu, you can use a lot of final screen content, directly copy and modify.

The finished effect is as follows:

5. build setting

Start by putting the Scene in Build Setting, select all of them in asset and drag them in. Then adjust the order and the result is as follows:

And then we have what doesn’t deserve to be called a game! That’s great!

6. Export the game

And then we’re going to export this thing that we made. Before exporting, we need to make some Settings.

6.1 Quality

Go to Edit->Project Setting->Quality. You can modify the quality setting when exporting:

Explanation:

  1. Below are some of the most familiar names for playing the game, but we’ll see what they do when we get the game right.
  2. On the top are the Settings that you can change, and then you can choose when you pack these things up. For example, now we have low, high, ultra. The game will then let you choose which quality level to use before it opens.
  3. We can add and remove different levels, set separately. You can also set the default level.

6.2 Player Setting

There are two entrances

  • One is build Setting, lower left.
  • Edit->Project Setting->Player.

You can see that you can change the company name, product name, and version. Game ICONS, mouse, things like that.

6.2.1 Game ICONS

Here we try to change the game icon. First import an image, then change the image’s properties, as shown in the following figure:

And then you can set it in Player Setting.

6.2.2 Resolution and Presentation

This is where you can set resolution, window, etc.

6.2.3 Splash Image

Set some splash screen related Settings. (The free version has very few features.)

6.2.4 Other Setting

It’s for bigger games. I’m not using it right now.

6.3 build

Build Setting is just that. There’s nothing to tell. After setting build select folder.

6.4 Packing an Installation Package

Build directly is not a good way to publish. (Except for sending it to friends) In most games, you get an installer and install it on your computer, and that’s what we’re going to do. To do this, we need a third-party tool called InnoSetup.

  1. For the first step, since we have no experience, we chose to use Script Wizard (the second option) and then click Next.
  2. The middle steps are intuitive.
  3. But one of the steps looks like this:Points to note:
    1. The first line is your EXE file, only this file.
    2. Then add all the files except this exe below. But there’s a problem with folders:
      • That is, it pulls out all the files in your folder and puts them at the same level as exe. Exe path reading error.
      • The solution is to create a layer of folders outside that folder, preferably with the same name. Then select the outer folder when importing the folder.
    3. There’s not much else to say, but it’s pretty straightforward. The installer file that came out last. An ISS script file. This file is an InnoSetup file that can be opened at any time to compile the Installer again.

7. The finished product