- Home /
Question by
Viwo04 · May 12 at 08:27 PM ·
unity 2dsound effectslevel load
Why the sound effect does not work in unity
Why the sound effect does not work in unity? When I try to add a sound effect, it doesn't work. This is my script to move to the next scene using buttons:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelLoader : MonoBehaviour
{
public Animator transition;
public float transitionTime = 1f;
public void LoadNextLevel()
{
StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
}
public AudioClip impact;
IEnumerator LoadLevel(int LevelIndex)
{
transition.SetTrigger("Start");
yield return new WaitForSeconds(transitionTime);
SceneManager.LoadScene(LevelIndex);
AudioSource.PlayClipAtPoint(impact, transform.position);
}
}
Comment
Your answer
Follow this Question
Related Questions
I can't add a second soundtrack in unity 0 Answers
How to have sound effects overlap? 1 Answer
One Slider Control More Than One Sound 1 Answer
How to generate levels in unity from ogmo editor? 0 Answers
Problem with sound 0 Answers