DMC1 _ Making ‘start’ button, move to other scene

Last time, we’ve learned how to move to other scene, and made start butt0n.

First, I downloaded the script here.

http://db.tt/83pvo3oF

스크린샷 2016-05-23 오전 10.18.41

Now go to unity, create a new project.

스크린샷 2016-05-23 오전 10.26.19.png

After making a new project, we will make 3 scene.

  1. startscene
  2. scene1
  3. scene2

And create a new folder named ‘scenes’, and drag three scenes to that folder.

스크린샷 2016-05-23 오전 10.26.39.png

스크린샷 2016-05-23 오전 10.27.43.png

And also make scripts folder, and bring those scripts there.

스크린샷 2016-05-23 오전 10.30.56.png

Now let’s create a terrain and move your main camera’s location.

Then we’ll create a ‘text’. Go to GameObject > UI > Text.

스크린샷 2016-05-23 오전 10.39.55.png

스크린샷 2016-05-23 오전 10.40.03.png

You can change the font, and transform its size.

If you select overflow in Horizontal and Vertical Overflow, your font can get bigger whatever you want.

스크린샷 2016-05-23 오전 10.57.42.png

스크린샷 2016-05-23 오전 11.01.04.png

Now we will add a background music. Create a audio folder, and I downloaded a music in asset store. In Gameobject, click Create empty. And change its name ‘audio’.

Inside audio’s inspector, add a component ‘audio source’.

And choose the music you want, and check ‘Loop’.

스크린샷 2016-05-23 오전 11.08.53.png

Next, we will make a start button. Create UI > button.

스크린샷 2016-05-23 오전 11.31.33.png

Make a start button, and customize yourself.

스크린샷 2016-05-23 오전 11.33.42.png

You can make button transparent. Write ‘0’ in alpha.

스크린샷 2016-05-23 오전 11.35.27.png

Now we will add a script.

If you double click the loadonclick.cs script, you’ll see this.

스크린샷 2016-05-23 오전 11.39.47.png

Now drag the loadonclick.cs script to the ‘canvas’ inspector.

스크린샷 2016-05-23 오전 11.42.18.png

Go to Button inspector, you can find ‘On Click ()’. Select Canvas, and choose LoadScene function.

스크린샷 2016-05-23 오전 11.47.23.png

스크린샷 2016-05-23 오전 11.48.00.png\

If we click the start button, player goes to the scene1.

스크린샷 2016-05-23 오전 11.50.01.png

Next, we’ll import a character package. Uncheck roller and third person, and import.

Now save the startscene, and go to the scene 1.

Delete the main camera, and bring ‘fps controller’ into your scene.

Create a terrain, and make a cube. Add a box collider in cube. Check trigger.

스크린샷 2016-05-23 오후 12.11.48.png

And you have to select the tag ‘player’.

스크린샷 2016-05-23 오후 12.18.25.png

Change the color of light. And test whether you can walk around.

스크린샷 2016-05-23 오후 12.10.34.png

Now make it same in scene2. When we collide with scene1’s cube, player will go to the scene2. Drag a move code into the scene1’s cube, and write scene2.

스크린샷 2016-05-28 오후 5.41.00.png

스크린샷 2016-05-28 오후 5.41.10.png

스크린샷 2016-05-28 오후 5.41.24.png

Now I can move around scene1 and 2 freely.

스크린샷 2016-05-28 오후 6.03.19.png

I made a start scene in my maze, but I clicked start button, but it doesn’t move on T.T..

I don’t know the reason, I will ask professor on next class.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s