- Home /
Preserve Mute Button (Unity 4.6) over multiple Scenes?
Hello,
Is there a way to preserve an UI button (Unity 4.6) over scenes?
I have a Mute sound button that I need to have in every scene. Can I do it via script or do I have to create the button in every scene? I have the button in the first Scene. I've attached this script to the button but I don't see the button in the second Scene.
using UnityEngine;
using System.Collections;
public class DontDestroyOnLoadButton : MonoBehaviour {
// Use this for initialization
void Awake () {
DontDestroyOnLoad(this);
}
}
Thank you!
Answer by jenci1990 · Dec 13, 2014 at 11:06 AM
Try this: DontDestroyOnLoad(transform.gameObject);
Hey,
Unfortunately my mute button is still destroyed because I don't see it in my next Scene.
Other suggestions?
Thanks for your effort!
Your answer
Follow this Question
Related Questions
Trigger a Button Click 2 Answers
Not Able to see Joystick & Button after deploying game to Android Device 1 Answer
How to update a content size fitter during runtime. 1 Answer
Is there a way to do different things depending on whether the button is being held or tapped? 2 Answers
Problem with buttons 1 Answer