- Home /
Question by
smirlianos · Dec 26, 2012 at 03:35 PM ·
javascriptdestroyontriggerenterloaddontdestroyonload
Don'tDestroyOnLoad issue, please help :(
I have this script in a manager GameObject.
var musicAudio : AudioClip;
function Start () {
audio.PlayOneShot(musicAudio);
}
function Awake () {
DontDestroyOnLoad (this);
}
and this one in a trigger that changes the level.
var level : int;
function OnTriggerEnter (other : Collider) {
if(other.gameObject.CompareTag("Player")){
Application.LoadLevel(level);
}
}
But when the player enters the trigger, nothing happens. I tried without the manager script, and it worked perfectly. But when I use it, notfing happens. Any help guys?
hthanks in advance! :)
Comment
Best Answer
Answer by paulaceccon · Dec 26, 2012 at 07:23 PM
Have you tried DontDestroyOnLoad (this.gameObject) ?
Your answer
Follow this Question
Related Questions
Not loading an object if it have be retained from a previous scene. 1 Answer
Enable/ Activate a script by script 1 Answer
What is wrong with my HealthBar/Damage Script? 2 Answers
Having difficulties making a block be a death trigger for a ball. 2 Answers
On Click, destroy object and any colliding object with the same tag. 6 Answers