Eda minigame but new branch

This commit is contained in:
2026-05-17 20:44:46 +02:00
parent dfec8df767
commit a15a9790b5
58 changed files with 1594 additions and 15 deletions

View File

@@ -0,0 +1,30 @@
using UnityEngine;
public class PlayAudioOnCamera : MonoBehaviour
{
public AudioClip clip; // assign your audio file in the Inspector
private AudioSource audioSource;
void Start()
{
// Get or add an AudioSource to this GameObject
audioSource = gameObject.GetComponent<AudioSource>();
if (audioSource == null)
{
audioSource = gameObject.AddComponent<AudioSource>();
}
// Assign the audio clip
if (clip != null)
{
audioSource.clip = clip;
audioSource.playOnAwake = false;
audioSource.loop = false; // change to true if you want looping
audioSource.Play();
}
else
{
Debug.LogWarning("PlayAudioOnCamera: No audio clip assigned!");
}
}
}