UNITY | Project | RPG Tutorial |23. Loading

2
Copy Component
3
Paste Component as Value
4
Adding Music
5
Adding Scene
6
“MenuControl” Script
  • add UnityEngine.SceneManagement to use Scene Manager
  • create a function, NewGame(),
    • add SceneManager.LoadScene()
    • when this function is activated, the scene 0 is loaded
7
UI – Button | On Click()
8
UI – Button | On Click()
9
Play On Awake
10
Adding Loading Screen with UI-RawImage
11
“MenuControl” Script
  • in NewGame(),
    • when the function is activated,
      • stop the music
      • turn on the loading screen
12
Adding Script
13
Loading Screen
14
Turn off Loading Screen
AC_44
Loading Screen Working

UNITY | PROJECT | SPACE SHOOTER 2D | 9. Score UI, SFX & BGM

2
Resetting Position when Game Starts
3
Score Text UI
4
Creating “GameScore” Script
5
“GameScore” Scrip
  • Set a Property, “Score”
  • In “Start()” method,
    • Get “Text” component to “scoreTextUI”
  • Create “UpdateScoreTextUI()”
    • create “scoreStr” string variable like a temporary bowl to keep “score”
    • put “scoreStr” into “scoreTextUI” by using “Text.text”
9. Score UI, SFX - BGM
Tagging & Adding Script

 

7
Getting “ScoreTextUI” with Tag
9. Score UI, SFX - BGM
“scoreTextUI” Reference | Set the score to 0 when Game Starts
  • Add scoreTextUI
  • in case of “GamePlay”
    • set the score to 0 by setting the Property of “GameScore” class
8
Don’t Forget to Add Reference
10
Adding “AudioSource” & BGM
  • Create “BackGroundMusic” GameObject from EmptyGameObject
  • Add “Audio Source” to “BackGroundMusic”
    • Add “BackGroundMusic”  to “Audio Source”
11
Adding “AudioSource” & BGM
  • Add “Audio Source” to “Player”
    • Add “Laser” sound to “Audio Source”
12
“PlayerControl” Script
  • Add “audioSource” variable of “AudioSource” Class to use Audio Source attached to GameObject this script is attached to
  • In “Start()” method,
    • Get “Audiosource” component to “audioSource”
  • In “Update()”
    • add “audioSource.Play()” to play the laser sound when Space Bar is pressed

 

 

13
Adding “AudioSource” & BGM
  • Add “Audio Source” to “Explosion” Prefab
    • Add “Explosion” sound to “Audio Source”
  • For Prefab,
    • No need to create or configure a script
    • when Prefab appears in the scene, “Audio Source” is activated with “Play On Wake” on

 

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |13. Audio

2
Audio Clip
3
adding “Audio Source” to GameObject
4
adding “Audio Clip” to “Audio Source”
5
deselecting “Play On Awake” for Player’s Audio
6
Audio Source | Play on Awake

 

7
Adding “Audio Source” to GameObject

 

8
adding codes to “Game Controller” script to use “Audio Source” Component
9
adding “BGM” to “GameController” GameObject
10
Balancing Audio 1
11
Balancing Audio