nathanj
Junior Member

Posts: 66
Posts: 66
|
Post by nathanj on Nov 15, 2018 4:29:16 GMT
Hi Brian,
Finally got a multiplayer system to the point that we're starting to add audio.
For some reason, my Master Audio component is being disabled when I start the game. I have added the Master Audio Multiplayer Adaptor script to the game object and it has created a Network Identity (we're using UNet). At the moment I don't have any of the bools selected (Server only, local player authority, log diagnostics, etc...) but have tried all variations with no luck.
If I remove the Adaptor script the Master Audio component stays active when I press play. I've been through the documentation and can't find anything about why this would be happening.
Any ideas why this would be happening?
Using the newest MA and Unity 2018.2.15f1
Also, we're using USurvival.
Thanks in advance, Nathan
|
|
|
Post by DarkTonic Dev on Nov 15, 2018 5:32:14 GMT
It's a weird UNET thing. Any game object with a Network Identity will immediately disable itself during Awake if you're not in a multiplayer session. You need to connect to a room and only then have a Master Audio game object in Multiplayer mode. Probably easiest to just have a separate non-adaptered Master Audio game object in the previous Scene and use that until you connect to the room, then load up the multiplayer version of Master Audio game object. More info here: forum.unity.com/threads/gameobjects-with-networkidendity-are-getting-disabled.335828/
|
|
nathanj
Junior Member

Posts: 66
Posts: 66
|
Post by nathanj on Nov 15, 2018 5:53:10 GMT
Thanks for the reply.
I literally had just finished reading that page.
Could I also just add a script that sets the Master Audio object to active on start?
Edit, seems to work. Though running it directly On Start didn't work so I delayed it with a coroutine for 1 second and it did.
Thanks again, Nathan
|
|
|
Post by DarkTonic Dev on Nov 15, 2018 6:32:51 GMT
Yeah you could do that. But you wouldn't be able to have any sound until you enable it. Glad you are sorted!
Start probably doesn't work because of Script execution order. MasterAudio.cs is quite high on that list.
|
|