Uncover the Simple Trick to KEEP MUSIC PLAYING Between Scenes!

  Рет қаралды 27,879

Rehope Games

Rehope Games

Күн бұрын

Пікірлер: 37
@Garfield_Minecraft
@Garfield_Minecraft 8 ай бұрын
ok just remember to carry the speaker everywhere you go
@ChapCanai
@ChapCanai Жыл бұрын
I dont regret accidentally listening to the game music at 2x speed
@RehopeGames
@RehopeGames Жыл бұрын
😂
@pedrokkj7304
@pedrokkj7304 Жыл бұрын
Hey, I love your tutorials on music and SFX. How would I change music when entering a new scene? Create an audio script for each scene?
@RehopeGames
@RehopeGames Жыл бұрын
Hi, You can do this a few different ways. I think the simplest way; - You can create single Audio Manager ( carry it to all scenes with DontDestroyOnLoad method). - And You can access the Audio Manager from new Scene (from any Start function) and change the audio clip. Thanks for your feedback 🙏
@Satenc0
@Satenc0 10 ай бұрын
@@RehopeGames Would be good if you can elaborate a little bit more on this, how could I select a different audio file from a method of AudioSource? Also how to get the current scene name or index and based on that select the AudioSource to play
@boshhy
@boshhy Жыл бұрын
Thank you.
@x_arnie
@x_arnie Жыл бұрын
Very nice! But i have a problem of the music playing multiple times if i go between main menu and guide menu of my game.
@RehopeGames
@RehopeGames Жыл бұрын
Hi, You should take a look at Singleton Pattern 👍 Thanks 🙏
@shiverpei
@shiverpei Ай бұрын
Tysm!
@CaosCreativeStudio
@CaosCreativeStudio Жыл бұрын
I’m working on a project and I followed your tutorial. Everything works perfectly but the thing is I made a start screen that plays a certain music and when I transition to another scene that same music is still playing. I have assigned a new music to where my player is and I cannot hear that music because the music from the start screen is still playing, I also cannot hear my player jump or collect the coins. How would I fix
@RehopeGames
@RehopeGames Жыл бұрын
I think this video can give an idea on this topic. kzbin.info/www/bejne/hGnamYBnfM97atk Thank you 😊
@dertobbe1176
@dertobbe1176 Жыл бұрын
Huh, neat
@programmingwithryan
@programmingwithryan Жыл бұрын
Hello Sir can you share this project i want to test this game very much. And I want to use this for my project.Tks
@AidanRickards-v4t
@AidanRickards-v4t 8 ай бұрын
Having an issue where the sound effects aren't playing if I open an older screen (like my main menu), the music works fine, but nothing is able to register the audiomanager or the script.
@bigDtvworld
@bigDtvworld 2 ай бұрын
What about music continue after pause screen?
@yonezu5058
@yonezu5058 7 ай бұрын
Can it use with a multiplayer game?
@pandlyn
@pandlyn Жыл бұрын
how to change the melody in certain scenes?
@RehopeGames
@RehopeGames Жыл бұрын
Hi, maybe this video can give an idea for that kzbin.info/www/bejne/hGnamYBnfM97atk
@pandlyn
@pandlyn Жыл бұрын
@@RehopeGames i will try, thanks)
@Broockle
@Broockle Жыл бұрын
"public static AudioManager instance;" this line is giving me trouble. I never used 'static' before. How did you make yours work?
@RehopeGames
@RehopeGames Жыл бұрын
You should learn Singleton pattern 👌
@kursatkilitci7770
@kursatkilitci7770 Жыл бұрын
Thx bro
@RehopeGames
@RehopeGames Жыл бұрын
biz teşekkür ederiz 😊
@komradwide4660
@komradwide4660 Жыл бұрын
But how would you make it so that specific scenes wont have the audio play?
@RehopeGames
@RehopeGames Жыл бұрын
If you remove the Audio Listener component from the Main Camera in the scene where you don't want the sound to play, you won't hear any sound in that scene. This is the simplest method. But if it were me, I would write a small algorithm instead. 😎
@Stigma536
@Stigma536 Жыл бұрын
@@RehopeGames How do I make it so that in the Start/Title screen one audio plays, then in the options menu a different one plays, then in the main game a different one plays?
@Narwing
@Narwing Жыл бұрын
I love you
@RehopeGames
@RehopeGames Жыл бұрын
Thanks 😊
@aboodabusaif648
@aboodabusaif648 10 ай бұрын
bro my SFXSource give me null reference exception IDK why :(
@burgi2980
@burgi2980 Жыл бұрын
I just want the music to run if the same scene restarts and not if I for example go back to the menu scene. any help?
@RehopeGames
@RehopeGames Жыл бұрын
Hello , I understand your request. This code will give an idea for you. using UnityEngine; using UnityEngine.SceneManagement; public class MusicPlayer : MonoBehaviour { private static MusicPlayer instance = null; public AudioClip menuMusic; // Audio clip for menu music public AudioClip gameMusic; // Audio clip for game music private AudioSource audioSource; public static MusicPlayer Instance { get { return instance; } } void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); audioSource = GetComponent(); SceneManager.sceneLoaded += OnSceneLoaded; // Subscribe to scene loaded event } void OnSceneLoaded(Scene scene, LoadSceneMode mode) { // Change the music when returning to the menu scene if (scene.name == "MenuScene") { audioSource.clip = menuMusic; audioSource.Play(); } // Continue playing game music when switching to the game scene // only if it's not already playing the game music (e.g., after a restart within the game scene) else if (scene.name == "GameScene" && audioSource.clip != gameMusic) { audioSource.clip = gameMusic; audioSource.Play(); } } void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; // Unsubscribe from the event to prevent memory leaks } }
@l1ax175
@l1ax175 Жыл бұрын
THANKS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@RehopeGames
@RehopeGames Жыл бұрын
🙏🙏🙏😀
@FaKz92
@FaKz92 9 ай бұрын
your tutorials are good, but if the watcher did not saw the previous ones he's fucked up, and you never are reffering to the previous videos. This is a big minus in all your videos.
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 57 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
Rive - Interactive Text | 1 Part | Interactive Motion
21:27
Motion Design School
Рет қаралды 985
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,2 МЛН
Why Is It Bad That My Game Looks Good?
16:40
Deynum Studio
Рет қаралды 349 М.
I Made A Difficult Game About Climbing
15:04
Pontypants
Рет қаралды 2,2 МЛН
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 736 М.
How to make AWESOME Scene Transitions in Unity!
19:45
Brackeys
Рет қаралды 961 М.
Adding BGM And On/Off Sound Button - Easy Unity Tutorial
5:56
HOW TO MAKE MUSIC TRANSITIONS - EASY UNITY TUTORIAL
8:00
Blackthornprod
Рет қаралды 49 М.