using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class LogicScript : MonoBehaviour
{
public int score;
public Text scoreText;
public GameObject GameOverScreen;
[ContextMenu ("add score")]
public void addScore(int scoreToAdd)
{
score += scoreToAdd;
scoreText.text = score.ToString() +" Majors";
}
public void restartGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
CanI();
}
public void GameOver()
{
GameOverScreen.SetActive(true);
}
public AudioSource src;
public AudioClip sfx, sfx2, sfx3, sfx4;
public void weMajor()
{
src.clip = sfx;
src.Play();
}
public void End()
{
src.clip = sfx2;
src.Play();
}
public void CanI()
{
src.clip = sfx3;
src.Play();
}
public void Intro()
{
src.clip = sfx4;
src.Play();
}
}
Im calling the restartGame() function using a button, but the CanI() function never plays any audio. I know both the button and the CanI() function work independently but for some reason not when combining them like this. In my mind the scene should reset, the audio should play and then the computer exits the function. Why dosent this happen, what am i supposed to do?