Question by
Minecraftian808 · Nov 08, 2020 at 08:48 PM ·
2d-platformer
How do I play an audio clip when my character goes past a certain y level?
I am a beginner and want to play a glitch sound effect when my player gets snapped up from the void. Here is the script I want to edit:
using UnityEngine;
using System.Collections;
public class Respawn : MonoBehaviour
{
public float threshold;
void FixedUpdate()
{
if (transform.position.y < threshold)
transform.position = new Vector3(0, 0, 0);
}
}
Comment
Your answer