Skip to content

Commit 63c88b9

Browse files
committed
Fixes on the AudioManager, music in the Main Menu
1 parent ccd50ea commit 63c88b9

File tree

14 files changed

+184
-20
lines changed

14 files changed

+184
-20
lines changed

UOP1_Project/Assets/AddressableAssetsData/AssetGroups/MusicTracks.asset

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,56 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
1313
m_Name: MusicTracks
1414
m_EditorClassIdentifier:
15-
m_GroupName: Packed Assets
15+
m_GroupName: MusicTracks
1616
m_Data:
1717
m_SerializedData: []
1818
m_GUID: aeea0f42beabf4f468ce11b41d51e169
19-
m_SerializeEntries: []
19+
m_SerializeEntries:
20+
- m_GUID: 0d3b647e3c636ab40a6d9b48d8ffab35
21+
m_Address: Assets/Audio/Music/Music_Beach.wav
22+
m_ReadOnly: 0
23+
m_SerializedLabels: []
24+
m_MainAsset: {fileID: 0}
25+
m_TargetAsset: {fileID: 0}
26+
- m_GUID: f55746203c03f2141a9e1a1649072238
27+
m_Address: Assets/Audio/Music/Music_Forest.wav
28+
m_ReadOnly: 0
29+
m_SerializedLabels: []
30+
m_MainAsset: {fileID: 0}
31+
m_TargetAsset: {fileID: 0}
32+
- m_GUID: 9871c84304b51b24c9c545454c791b2f
33+
m_Address: Assets/Audio/Music/Music_Glade.wav
34+
m_ReadOnly: 0
35+
m_SerializedLabels: []
36+
m_MainAsset: {fileID: 0}
37+
m_TargetAsset: {fileID: 0}
38+
- m_GUID: 1a61bf74a2f341b498082f54f67188b5
39+
m_Address: Assets/Audio/Music/Music_MainTheme.wav
40+
m_ReadOnly: 0
41+
m_SerializedLabels: []
42+
m_MainAsset: {fileID: 0}
43+
m_TargetAsset: {fileID: 0}
44+
- m_GUID: 18249a96d1decd241a4e0fc9bb78ebb6
45+
m_Address: Assets/Audio/Music/Music_Path.wav
46+
m_ReadOnly: 0
47+
m_SerializedLabels: []
48+
m_MainAsset: {fileID: 0}
49+
m_TargetAsset: {fileID: 0}
50+
- m_GUID: 72ef6eda0caaa744a819f1c0bcfce397
51+
m_Address: Assets/Audio/Music/Music_PauseMenu.wav
52+
m_ReadOnly: 0
53+
m_SerializedLabels: []
54+
m_MainAsset: {fileID: 0}
55+
m_TargetAsset: {fileID: 0}
56+
- m_GUID: 848739acdaf728b45a57a87160f9021e
57+
m_Address: Assets/Audio/Music/Music_Town.wav
58+
m_ReadOnly: 0
59+
m_SerializedLabels: []
60+
m_MainAsset: {fileID: 0}
61+
m_TargetAsset: {fileID: 0}
2062
m_ReadOnly: 0
2163
m_Settings: {fileID: 11400000, guid: bffab80dc16c4464b92b2e97b6a1964c, type: 2}
2264
m_SchemaSet:
23-
m_Schemas: []
65+
m_Schemas:
66+
- {fileID: 11400000, guid: 8463d1b8bad77e342b617bcedc02ec3a, type: 2}
67+
- {fileID: 11400000, guid: a19f7b2b258a48f49aa5e6ab3a77c765, type: 2}

UOP1_Project/Assets/AddressableAssetsData/AssetGroups/SFX.asset

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
1313
m_Name: SFX
1414
m_EditorClassIdentifier:
15-
m_GroupName: Packed Assets
15+
m_GroupName: SFX
1616
m_Data:
1717
m_SerializedData: []
1818
m_GUID: 7085e6b05c846d2448d509eb503e4d43
19-
m_SerializeEntries: []
19+
m_SerializeEntries:
20+
- m_GUID: 283a4aea3a1670c4ebf8fa5901d18c08
21+
m_Address: Assets/Audio/SFX
22+
m_ReadOnly: 0
23+
m_SerializedLabels: []
24+
m_MainAsset: {fileID: 102900000, guid: 283a4aea3a1670c4ebf8fa5901d18c08, type: 3}
25+
m_TargetAsset: {fileID: 102900000, guid: 283a4aea3a1670c4ebf8fa5901d18c08, type: 3}
2026
m_ReadOnly: 0
2127
m_Settings: {fileID: 11400000, guid: bffab80dc16c4464b92b2e97b6a1964c, type: 2}
2228
m_SchemaSet:
23-
m_Schemas: []
29+
m_Schemas:
30+
- {fileID: 11400000, guid: 55465dd6c93d83d439579d4dfa80c947, type: 2}
31+
- {fileID: 11400000, guid: c3328767eca3b18418a23e420b4e3b86, type: 2}

UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Schemas/MusicTracks_BundledAssetGroupSchema.asset

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
1313
m_Name: MusicTracks_BundledAssetGroupSchema
1414
m_EditorClassIdentifier:
15-
m_Group: {fileID: 0}
15+
m_Group: {fileID: 11400000, guid: c6089159bfe469d46ad3b0e68fe4aa09, type: 2}
1616
m_Compression: 1
1717
m_IncludeAddressInCatalog: 1
1818
m_IncludeGUIDInCatalog: 1
@@ -31,10 +31,10 @@ MonoBehaviour:
3131
m_RedirectLimit: -1
3232
m_RetryCount: 0
3333
m_BuildPath:
34-
m_Id:
34+
m_Id: 5002d2ecf2c3647f8b6e3a264a6b45f8
3535
m_LoadPath:
36-
m_Id:
37-
m_BundleMode: 0
36+
m_Id: 343a2af8396fc47cb9e730bf77e141f0
37+
m_BundleMode: 1
3838
m_AssetBundleProviderType:
3939
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
4040
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider

UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Schemas/MusicTracks_ContentUpdateGroupSchema.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
1313
m_Name: MusicTracks_ContentUpdateGroupSchema
1414
m_EditorClassIdentifier:
15-
m_Group: {fileID: 0}
16-
m_StaticContent: 0
15+
m_Group: {fileID: 11400000, guid: c6089159bfe469d46ad3b0e68fe4aa09, type: 2}
16+
m_StaticContent: 1

UOP1_Project/Assets/Scenes/Menus/MainMenu.unity

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ LightmapSettings:
9898
m_TrainingDataDestination: TrainingData
9999
m_LightProbeSampleCountMultiplier: 4
100100
m_LightingDataAsset: {fileID: 0}
101-
m_UseShadowmask: 1
101+
m_UseShadowmask: 0
102102
--- !u!196 &4
103103
NavMeshSettings:
104104
serializedVersion: 2
@@ -121,6 +121,81 @@ NavMeshSettings:
121121
debug:
122122
m_Flags: 0
123123
m_NavMeshData: {fileID: 0}
124+
--- !u!1001 &115741521
125+
PrefabInstance:
126+
m_ObjectHideFlags: 0
127+
serializedVersion: 2
128+
m_Modification:
129+
m_TransformParent: {fileID: 0}
130+
m_Modifications:
131+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
132+
type: 3}
133+
propertyPath: m_RootOrder
134+
value: 0
135+
objectReference: {fileID: 0}
136+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
137+
type: 3}
138+
propertyPath: m_LocalPosition.x
139+
value: 0
140+
objectReference: {fileID: 0}
141+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
142+
type: 3}
143+
propertyPath: m_LocalPosition.y
144+
value: 0
145+
objectReference: {fileID: 0}
146+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
147+
type: 3}
148+
propertyPath: m_LocalPosition.z
149+
value: 0
150+
objectReference: {fileID: 0}
151+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
152+
type: 3}
153+
propertyPath: m_LocalRotation.w
154+
value: 1
155+
objectReference: {fileID: 0}
156+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
157+
type: 3}
158+
propertyPath: m_LocalRotation.x
159+
value: 0
160+
objectReference: {fileID: 0}
161+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
162+
type: 3}
163+
propertyPath: m_LocalRotation.y
164+
value: 0
165+
objectReference: {fileID: 0}
166+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
167+
type: 3}
168+
propertyPath: m_LocalRotation.z
169+
value: 0
170+
objectReference: {fileID: 0}
171+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
172+
type: 3}
173+
propertyPath: m_LocalEulerAnglesHint.x
174+
value: 0
175+
objectReference: {fileID: 0}
176+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
177+
type: 3}
178+
propertyPath: m_LocalEulerAnglesHint.y
179+
value: 0
180+
objectReference: {fileID: 0}
181+
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
182+
type: 3}
183+
propertyPath: m_LocalEulerAnglesHint.z
184+
value: 0
185+
objectReference: {fileID: 0}
186+
- target: {fileID: 7961433267914593992, guid: 0b664a194840b8947ba233200964f991,
187+
type: 3}
188+
propertyPath: m_Name
189+
value: MusicPlayer
190+
objectReference: {fileID: 0}
191+
- target: {fileID: 7961433267914593993, guid: 0b664a194840b8947ba233200964f991,
192+
type: 3}
193+
propertyPath: _thisSceneSO
194+
value:
195+
objectReference: {fileID: 11400000, guid: 431ff81b74b48fb4d9301fb76ca633dd,
196+
type: 2}
197+
m_RemovedComponents: []
198+
m_SourcePrefab: {fileID: 100100000, guid: 0b664a194840b8947ba233200964f991, type: 3}
124199
--- !u!1 &403475996
125200
GameObject:
126201
m_ObjectHideFlags: 0
@@ -720,7 +795,7 @@ PrefabInstance:
720795
- target: {fileID: 40564194958535909, guid: 54d1f8b93400ea64d97c276fab375df3,
721796
type: 3}
722797
propertyPath: m_RootOrder
723-
value: 0
798+
value: 1
724799
objectReference: {fileID: 0}
725800
- target: {fileID: 40564194958535909, guid: 54d1f8b93400ea64d97c276fab375df3,
726801
type: 3}
@@ -1046,7 +1121,7 @@ Transform:
10461121
m_LocalScale: {x: 1, y: 1, z: 1}
10471122
m_Children: []
10481123
m_Father: {fileID: 0}
1049-
m_RootOrder: 3
1124+
m_RootOrder: 4
10501125
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
10511126
--- !u!81 &1419319622
10521127
AudioListener:
@@ -1139,7 +1214,7 @@ Transform:
11391214
m_LocalScale: {x: 1, y: 1, z: 1}
11401215
m_Children: []
11411216
m_Father: {fileID: 0}
1142-
m_RootOrder: 2
1217+
m_RootOrder: 3
11431218
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
11441219
--- !u!1 &1806157292
11451220
GameObject:
@@ -1478,7 +1553,7 @@ RectTransform:
14781553
- {fileID: 684748717}
14791554
- {fileID: 821853655}
14801555
m_Father: {fileID: 0}
1481-
m_RootOrder: 1
1556+
m_RootOrder: 2
14821557
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
14831558
m_AnchorMin: {x: 0, y: 0}
14841559
m_AnchorMax: {x: 0, y: 0}

UOP1_Project/Assets/StreamingAssets.meta renamed to UOP1_Project/Assets/Scenes/Skybox/ClearSky.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: 08e854ccd8588da4694c3ae040c10c5e, type: 3}
13+
m_Name: Music_MainTheme
14+
m_EditorClassIdentifier:
15+
looping: 1
16+
_audioClipGroups:
17+
- sequenceMode: 2
18+
audioClips:
19+
- {fileID: 8300000, guid: 1a61bf74a2f341b498082f54f67188b5, type: 3}

UOP1_Project/Assets/ScriptableObjects/Audio/AudioCues/Music/Music_MainTheme.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UOP1_Project/Assets/ScriptableObjects/SceneData/Menus/MainMenu.asset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: 3546e1f9ebb6f054fb677b86f543542b, type: 3}
1313
m_Name: MainMenu
1414
m_EditorClassIdentifier:
15+
_guid: 431ff81b74b48fb4d9301fb76ca633dd
1516
description: Main/title menu, the only menu that exists as a standalone scene
1617
sceneType: 1
1718
sceneReference:
1819
m_AssetGUID: df490f8a21305b549b67b8301af79724
1920
m_SubObjectName:
2021
m_SubObjectType:
22+
musicTrack: {fileID: 11400000, guid: 755065c424b9ce346977ffa54ae3c9c1, type: 2}

UOP1_Project/Assets/Scripts/Audio/AudioManager.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ private AudioCueKey PlayMusicTrack(AudioCueSO audioCue, AudioConfigurationSO aud
124124

125125
_musicSoundEmitter = _pool.Request();
126126
_musicSoundEmitter.FadeMusicIn(audioCue.GetClips()[0], audioConfiguration, 1f, startTime);
127+
_musicSoundEmitter.OnSoundFinishedPlaying += StopMusicEmitter;
127128

128129
return AudioCueKey.Invalid; //No need to return a valid key for music
129130
}
@@ -216,4 +217,10 @@ private void StopAndCleanEmitter(SoundEmitter soundEmitter)
216217
//_soundEmitterVault.Remove(audioCueKey); is never called if StopAndClean is called after a Finish event
217218
//How is the key removed from the vault?
218219
}
220+
221+
private void StopMusicEmitter(SoundEmitter soundEmitter)
222+
{
223+
soundEmitter.OnSoundFinishedPlaying -= StopMusicEmitter;
224+
_pool.Return(soundEmitter);
225+
}
219226
}

0 commit comments

Comments
 (0)