// Start is called before the first frame update
    void Start()
    {
        target  = GameObject.FindWithTag("Volumen");
        volumen = target.GetComponent <NoDestruir>();
        barra   = GetComponent <Slider>();

        if (cambia == "effectvolumen")
        {
            barra.value = volumen.effectvolumen;
        }
        else if (cambia == "musicvolumen")
        {
            barra.value = volumen.musicvolumen;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        sound   = GetComponent <AudioSource>();
        target  = GameObject.FindWithTag("Volumen");
        volumen = target.GetComponent <NoDestruir>();

        if (tipo == "effect")
        {
            sound.volume = volumen.effectvolumen;
        }
        else if (tipo == "music")
        {
            sound.volume = volumen.musicvolumen;
        }
        Destroy(gameObject, tiempo);
    }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     // COIDGO PATRON SINGLETON
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         //No existe instancia
         //Guardamos nuestra referencia
         Instance = this;
         //Le decimos a unity que no destruya el objeto entre escenas
         DontDestroyOnLoad(gameObject);
     }
 }
 void Awake()
 {
     target  = GameObject.FindWithTag("Volumen");
     volumen = target.GetComponent <NoDestruir>();
 }