-
Notifications
You must be signed in to change notification settings - Fork 1
Asset Programming
Asset Programming Documentation
I will advice you to go learn the basics of Unity UI before proceeding:
A Beginner Guide to TEXTMESHPRO (Unity UI Tutorial)
All the UI prefabs you will need can be found in this location
First time use
The UI System prefab should be dragged to the first scene in the game. All menu prefabs should be dragged into the "Menu Prefabs".
Simple way to open a menu: MenuCassName.Open(Action OnOpened = null);
MainMenu.Open();
or
MainMenu.Open("A void Function or lambda");
Simple way to close a menu : : MenuCassName.Close(Action OnClosed= null);
MainMenu.Close();
or
MainMenu.Close("A void Function or lambda");
- Drag the Menu Prefab into the scene
- You can see all the properties in the inspector
- Now you can edit the Image and location of UI components
I will advice you to go learn the basics of Unity Audio before proceeding
Introduction to AUDIO in Unity
Drag the Audio Manager to the first scene
- Music Bank - Audio Bank
- Sfx Bank (Sound Effect) - Audio Bank
- Music Player - Audio source
- SoundEffect Player - Audio source
Make sure all required components are dragged in place to avoid error.
- A single data in the audio bank contains - > ID (Audio ID), Audio Clip and Info
- The ID is very important and needs to be unique per data, this is used for getting the audio clip in code
- The Audio Clip is a reference to the audio clip asset, this can be dragged in or selected by clicking on the white circle dot on the right the field.
- The Similar Audi Clip is a reference to the audio clip array. Used for audio with random sounds
- The Info text field is useful for providing little information about the audio if necessary
The audio bank will give error if there are more than one data with the same ID. The audio bank single data box will be red if it has no audio clip. Make sure you put music in music bank & sound effects in Sfx bank!!!
// AudioManager.GetMusicClip(string audioID)
// AudioManager.GetSoundEffectClip(string audioID)
// AudioManager.PlayMusic(string audioID, bool loop = true)
// AudioManager.PauseMusic()
// AudioManager.ResumeMusic()
// AudioManager.StopMusic()
// AudioManager.ChangeMusicWithFade(string audioID, bool loop = true, float speed = 0.05f)
// AudioManager.BlendTwoMusic(string startAudioID, string nextAudioID, bool loop = true)
// AudioManager.PlaySoundEffect(string audioID, bool randomPitch = false)
Watch this video to understand the basics of Unity 3D Audio
Audio Only Be Heard in a Certain Radius/Distance - Unity 3D Sound
- Add the Audio3D script to your gameobjects, it will automatically add an audio source component
- You need to set the audio source component -> Spatial Blend = 1;
- You also need to edit the 3D Sound settings -> Volume Rolloff can be set to Linear Rolloff
- You can then edit the min distance and max distance to your preference.
// PlaySoundEffect(string audioID)
// PlayMusic(string audioID, bool loop)
// SetMinDistance(float minDistance) "Distance of sound"
// SetMaxDistance(float maxDistance) "Distance of sound"