1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:05,000
In this video we're going to make day and night system can be pretty easy again.

3
00:00:05,000 --> 00:00:06,000
We're going to use acid store.

4
00:00:06,000 --> 00:00:07,000
Let's go to window.

5
00:00:07,000 --> 00:00:08,000
Acid store.

6
00:00:11,000 --> 00:00:12,000
We're going to type here.

7
00:00:12,000 --> 00:00:14,000
Just I'm sorry.

8
00:00:14,000 --> 00:00:16,000
Are we going to type skybox?

9
00:00:18,000 --> 00:00:19,000
This is the one.

10
00:00:19,000 --> 00:00:20,000
Where is it?

11
00:00:22,000 --> 00:00:23,000
This is the one make.

12
00:00:23,000 --> 00:00:27,000
If you want to make it easier to find, let's just click free asset over here.

13
00:00:28,000 --> 00:00:28,000
Yeah.

14
00:00:28,000 --> 00:00:29,000
So this is the one.

15
00:00:29,000 --> 00:00:30,000
I will attach the link as well.

16
00:00:31,000 --> 00:00:33,000
We're going to click Open in Unity.

17
00:00:36,000 --> 00:00:37,000
Then we're going to.

18
00:00:37,000 --> 00:00:39,000
Oh, disappeared from my list.

19
00:00:39,000 --> 00:00:42,000
Why is that skybox?

20
00:00:45,000 --> 00:00:49,000
Yeah, we're going to do a download and then import.

21
00:00:49,000 --> 00:00:51,000
Let's click import.

22
00:00:51,000 --> 00:00:52,000
And this asset is a bit heavy.

23
00:00:52,000 --> 00:00:58,000
There are some extra meshes and materials that we don't need, so I want to show you how to delete them.

24
00:00:58,000 --> 00:00:59,000
What can you delete?

25
00:00:59,000 --> 00:01:00,000
What you cannot?

26
00:01:00,000 --> 00:01:01,000
Let's click reload.

27
00:01:03,000 --> 00:01:03,000
Okay.

28
00:01:04,000 --> 00:01:06,000
So we're going to go to this folder box public.

29
00:01:06,000 --> 00:01:11,000
We don't touch utils, but we can go to user and delete this user folder.

30
00:01:12,000 --> 00:01:13,000
Over here.

31
00:01:13,000 --> 00:01:15,000
Well, let me make it a bit bigger.

32
00:01:15,000 --> 00:01:17,000
In the icons, we don't need a PDF file.

33
00:01:17,000 --> 00:01:21,000
In the demo matches, we don't need these matches because this is just the models from them.

34
00:01:21,000 --> 00:01:23,000
I seen that was with the asset.

35
00:01:23,000 --> 00:01:25,000
So we can delete this one.

36
00:01:28,000 --> 00:01:31,000
We can delete them since we don't need them, we don't need to touch textures.

37
00:01:31,000 --> 00:01:32,000
Be careful there.

38
00:01:32,000 --> 00:01:33,000
We don't need settings.

39
00:01:33,000 --> 00:01:35,000
We can delete settings.

40
00:01:35,000 --> 00:01:38,000
We can go to prefab and.

41
00:01:39,000 --> 00:01:42,000
Delete this prefabs of the meshes fans Fire tree.

42
00:01:43,000 --> 00:01:43,000
We don't need it.

43
00:01:44,000 --> 00:01:45,000
In the materials.

44
00:01:45,000 --> 00:01:47,000
We need to delete everything except skyboxes.

45
00:01:47,000 --> 00:01:50,000
So these we don't need delete.

46
00:01:50,000 --> 00:01:52,000
Okay, now let's set it up.

47
00:01:52,000 --> 00:01:55,000
Let's go to main camera and change this.

48
00:01:55,000 --> 00:01:57,000
Clear flags from solid color to skybox.

49
00:01:58,000 --> 00:02:04,000
Now we're going to go to window rendering lighting environment.

50
00:02:04,000 --> 00:02:06,000
And here we're going to change skybox.

51
00:02:08,000 --> 00:02:09,000
Let's find our that we need.

52
00:02:10,000 --> 00:02:11,000
There are three of them.

53
00:02:11,000 --> 00:02:13,000
Let's choose day.

54
00:02:14,000 --> 00:02:16,000
And this is already pretty.

55
00:02:16,000 --> 00:02:17,000
I really like it.

56
00:02:18,000 --> 00:02:22,000
What we can do to make it better is actually to hide the mountains.

57
00:02:22,000 --> 00:02:24,000
They don't look really good with this one.

58
00:02:24,000 --> 00:02:26,000
They kind of hide in the sky behind.

59
00:02:26,000 --> 00:02:28,000
So let's find the mountains.

60
00:02:28,000 --> 00:02:30,000
I guess this is the fifth background.

61
00:02:31,000 --> 00:02:33,000
Please don't switch off the object.

62
00:02:33,000 --> 00:02:35,000
Just select the sprites.

63
00:02:37,000 --> 00:02:39,000
And make them transparent.

64
00:02:41,000 --> 00:02:42,000
All right.

65
00:02:43,000 --> 00:02:47,000
Because we have Polygon Collider on the ground five and we cannot switch it off.

66
00:02:47,000 --> 00:02:48,000
We need it.

67
00:02:49,000 --> 00:02:49,000
Good.

68
00:02:49,000 --> 00:02:51,000
So basically, this already looks good.

69
00:02:51,000 --> 00:02:54,000
And just what we need, I think looks amazing.

70
00:02:55,000 --> 00:03:01,000
I might not sound so excited, but this is because I did it before and I was really happy at that time

71
00:03:01,000 --> 00:03:02,000
when I found it.

72
00:03:02,000 --> 00:03:04,000
But now it's just like, okay, beautiful sky.

73
00:03:04,000 --> 00:03:05,000
Yeah.

74
00:03:05,000 --> 00:03:06,000
So this is how it's going to look.

75
00:03:06,000 --> 00:03:08,000
And you have to agree with me.

76
00:03:08,000 --> 00:03:11,000
This makes this game so much more beautiful.

77
00:03:11,000 --> 00:03:14,000
It's just breathtaking, I would say.

78
00:03:14,000 --> 00:03:16,000
Yeah, this is breathtaking.

79
00:03:16,000 --> 00:03:20,000
So now let's make a day night cycle.

80
00:03:20,000 --> 00:03:23,000
And actually, we're not going to make the night cycle because how long is the one run?

81
00:03:23,000 --> 00:03:23,000
Come on.

82
00:03:23,000 --> 00:03:25,000
20 seconds to one minute.

83
00:03:25,000 --> 00:03:31,000
But we can switch random skybox when we play in the game for the first time or on each run.

84
00:03:31,000 --> 00:03:32,000
How we do that?

85
00:03:32,000 --> 00:03:33,000
Pretty simple.

86
00:03:33,000 --> 00:03:37,000
We need to go to game manager because this is kind of a way for us to control everything.

87
00:03:38,000 --> 00:03:40,000
Now I want to change this header.

88
00:03:40,000 --> 00:03:42,000
Honestly, I want to do per chase.

89
00:03:43,000 --> 00:03:48,000
Purchased color because when I saw it in the inspector, I didn't really understood what is that color

90
00:03:48,000 --> 00:03:48,000
in for?

91
00:03:50,000 --> 00:03:51,000
Now let's make another header.

92
00:03:53,000 --> 00:03:55,000
Just here, Heather.

93
00:03:55,000 --> 00:03:59,000
Skybox materials.

94
00:04:00,000 --> 00:04:05,000
And then we're going to need we can do private serialized field, private material.

95
00:04:06,000 --> 00:04:07,000
We're going to need array.

96
00:04:08,000 --> 00:04:09,000
Sky box.

97
00:04:09,000 --> 00:04:17,000
Matt Okay, Now let's go and create a function to control skybox material, because we want to call

98
00:04:17,000 --> 00:04:19,000
this function from the UI in the settings.

99
00:04:19,000 --> 00:04:21,000
If you remember, we have buttons to control that.

100
00:04:21,000 --> 00:04:25,000
So how I want to do this, I want to place material of the skybox.

101
00:04:25,000 --> 00:04:29,000
They under number zero and night under number one, and the third one, the blended.

102
00:04:29,000 --> 00:04:30,000
I will not place it.

103
00:04:30,000 --> 00:04:32,000
It will be only in the random list.

104
00:04:32,000 --> 00:04:36,000
Now let's create a function public void.

105
00:04:37,000 --> 00:04:39,000
Set up skybox.

106
00:04:41,000 --> 00:04:45,000
We're going to pass our value through this one int i.

107
00:04:46,000 --> 00:04:47,000
So we're going to need a number.

108
00:04:47,000 --> 00:04:49,000
Then we're going to do this.

109
00:04:49,000 --> 00:04:58,000
Renderer settings dot Skybox equals to Skybox Matte A and this way we can switch between them.

110
00:04:59,000 --> 00:05:00,000
Now give me a second to explain.

111
00:05:00,000 --> 00:05:02,000
Why do we use an AI in there?

112
00:05:02,000 --> 00:05:07,000
We need this index to check if I is less or equals to one.

113
00:05:07,000 --> 00:05:12,000
And if it is, we're going to either choose the skybox or a knight skybox.

114
00:05:12,000 --> 00:05:12,000
So let's do this.

115
00:05:12,000 --> 00:05:17,000
If I is lesser equals to one, then we're going to choose skybox.

116
00:05:17,000 --> 00:05:20,000
Matt I in any other case, we're going to choose random.

117
00:05:20,000 --> 00:05:27,000
I'm going to duplicate this line and just type here random range from zero to skybox material dot lens.

118
00:05:27,000 --> 00:05:33,000
And right after we chose the skybox, I want to save this number for our next run.

119
00:05:33,000 --> 00:05:39,000
So it's going to be just player press set INT And we're going to need the number skybox settings.

120
00:05:41,000 --> 00:05:43,000
And we're going to pass an I number.

121
00:05:43,000 --> 00:05:45,000
Now, let's call this function in a week.

122
00:05:48,000 --> 00:05:54,000
Set up skybox and it still need an integer, but this time we can get it from player press.

123
00:05:54,000 --> 00:05:58,000
So let's copy this, paste it in and change set to get.

124
00:05:58,000 --> 00:06:05,000
We're not going to do it here because at the moment, if nothing is saved, it's going to choose zero

125
00:06:05,000 --> 00:06:07,000
and zero is our day skybox.

126
00:06:07,000 --> 00:06:12,000
So basically daytime going to be set by default if nothing was saved before.

127
00:06:12,000 --> 00:06:15,000
Now, if it doesn't make sense to you too much, wait for a second.

128
00:06:15,000 --> 00:06:17,000
We need to create a UI button.

129
00:06:17,000 --> 00:06:19,000
Let's go to UI mean.

130
00:06:22,000 --> 00:06:22,000
Yeah.

131
00:06:23,000 --> 00:06:28,000
Somewhere here, we're going to create public void switch books.

132
00:06:28,000 --> 00:06:32,000
We're going to pass an I int index.

133
00:06:32,000 --> 00:06:34,000
Inside, we're going to call game manager.

134
00:06:35,000 --> 00:06:39,000
Game manager, that instance that set up skybox.

135
00:06:39,000 --> 00:06:41,000
We're going to pass index as well.

136
00:06:41,000 --> 00:06:44,000
And I guess we can play a sound when we click in this button.

137
00:06:44,000 --> 00:06:46,000
So let's copy this line of code and paste it in here.

138
00:06:47,000 --> 00:06:48,000
All right.

139
00:06:49,000 --> 00:06:50,000
Good enough.

140
00:06:50,000 --> 00:06:51,000
Let's go to unit two now.

141
00:06:55,000 --> 00:06:56,000
First, I want to open this array.

142
00:06:56,000 --> 00:06:57,000
Click.

143
00:06:57,000 --> 00:07:00,000
Lock it, then go to folder with the skybox over here.

144
00:07:00,000 --> 00:07:01,000
Skybox.

145
00:07:03,000 --> 00:07:04,000
Demo material.

146
00:07:04,000 --> 00:07:06,000
Take the skybox material.

147
00:07:06,000 --> 00:07:12,000
First day, then night, and then blend like that.

148
00:07:13,000 --> 00:07:15,000
Now we can unlock it.

149
00:07:15,000 --> 00:07:16,000
Go to canvas.

150
00:07:17,000 --> 00:07:21,000
Sightings Saturday night and random.

151
00:07:21,000 --> 00:07:26,000
Go below click plus drag the canvas.

152
00:07:26,000 --> 00:07:28,000
Find UI main.

153
00:07:29,000 --> 00:07:30,000
Switch skybox.

154
00:07:30,000 --> 00:07:34,000
Now we need to give it a number so they can have zero night.

155
00:07:34,000 --> 00:07:35,000
Number one.

156
00:07:35,000 --> 00:07:37,000
Random can be anything bigger than one.

157
00:07:37,000 --> 00:07:38,000
I'll choose number two.

158
00:07:39,000 --> 00:07:41,000
Now we can go to settings and check this.

159
00:07:43,000 --> 00:07:44,000
They.

160
00:07:45,000 --> 00:07:45,000
Night.

161
00:07:45,000 --> 00:07:46,000
Day.

162
00:07:46,000 --> 00:07:46,000
Night.

163
00:07:46,000 --> 00:07:47,000
Day.

164
00:07:47,000 --> 00:07:48,000
Night.

165
00:07:48,000 --> 00:07:48,000
Random.

166
00:07:49,000 --> 00:07:52,000
And whatever you choose is going to be saved for your next run.

167
00:07:52,000 --> 00:07:53,000
So, for example, night.

168
00:07:55,000 --> 00:07:56,000
Good job, guys.

169
00:07:56,000 --> 00:07:57,000
Good job, guys.

170
00:07:57,000 --> 00:08:00,000
We are really close to finish.

171
00:08:00,000 --> 00:08:02,000
Really, really close to finish.

172
00:08:02,000 --> 00:08:03,000
So just hang in there.

173
00:08:03,000 --> 00:08:08,000
There are a couple of more videos left and you will have yourself a pretty finished game.

174
00:08:09,000 --> 00:08:10,000
Let's go and do this.

