Question by
Minecraftian808 · Nov 09, 2020 at 07:43 PM ·
2d game2d-platformer
How do I play an audio clip when my character goes past a certain y level?
I'm a beginner and need help on how to make an audio clip play when you go past a certain y level. 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
Follow this Question
Related Questions
Player is bouncing when colliding with wall object 0 Answers
Tilemap doesn't showing on window?? unity 5.6.1f1 ,Tilemap not showing on the Window or as 2D Object 0 Answers
2D movement with gravity shifting 0 Answers
hi i want to add a slid and wall jump to my script with animation, i am lost ^^ 0 Answers
How do i flip my character in 2D platformers,Im at a loss on flipping my 2D character 0 Answers