ici_recycle_vr/Assets/Scripts/LidSound.cs
Diaconescu Andrei-Alexandru 19674bfe5d Am adaugat ICI Recycle
2025-05-26 12:54:36 +03:00

27 lines
508 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LidSound : MonoBehaviour
{
private AudioSource src;
private void Start()
{
src = GetComponent<AudioSource>();
}
private void OnCollisionEnter(Collision collision)
{
//Check if the layer is named StopperLayer
if (collision.gameObject.layer == LayerMask.NameToLayer("StopperLayer"))
{
//Play the sound
src.Play();
}
}
}