Skip to content
Snippets Groups Projects
Commit b2507a78 authored by mhz1g21's avatar mhz1g21
Browse files

attempt to fix moving speakers

parent 2691f573
No related branches found
No related tags found
2 merge requests!9working premade rooms ui, also exportable as .exe (works),!8added #if UNITY_EDITOR #endif directives to all editor related scripts to...
...@@ -83,6 +83,13 @@ public class BuildRoom : MonoBehaviour { ...@@ -83,6 +83,13 @@ public class BuildRoom : MonoBehaviour {
// Instantiate the speaker prefab // Instantiate the speaker prefab
GameObject speaker = Instantiate(interactableAudioSourcePrefab, new Vector3(x, y, z), Quaternion.identity); GameObject speaker = Instantiate(interactableAudioSourcePrefab, new Vector3(x, y, z), Quaternion.identity);
// Ensure the speaker stays in place
Rigidbody rb = speaker.GetComponent<Rigidbody>();
if (rb != null)
{
rb.isKinematic = true;
}
// Set the audio clip for the speaker // Set the audio clip for the speaker
AudioSource audioSource = speaker.GetComponent<AudioSource>(); AudioSource audioSource = speaker.GetComponent<AudioSource>();
audioSource.clip = Resources.Load<AudioClip>(audioPath); audioSource.clip = Resources.Load<AudioClip>(audioPath);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment