- Home /
Change Pitch on Collision
This is a very brief script that is supposed to do a very simple thing. What's wrong with it?
using UnityEngine;
using System.Collections;
public class SoundManager : MonoBehaviour
{
public AudioSource Backgroundmusic;
void OnCollisionEnter(Collider other) {
if (other.tag == "Player") {
Backgroundmusic.pitch = 0.4f;
}
}
}
Comment
Answer by Adam-Mechtley · Nov 30, 2016 at 07:59 AM
Well what is wrong with it on your end? Is the OnCollisionEnter message never received? Or is this method called but the conditional block is never entered? If it's the former, make sure you check the Collision Action Matrix in the documentation against your setup.
Your answer
Follow this Question
Related Questions
Sound on collision 3 Answers
Audio on collision is not playing 1 Answer
Rigidbody crate collide sound. 0 Answers
Getting audio to play on collision 3 Answers
Audio Script 1 Answer