Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
Transfering data between multiple scenes

I am new to C# and Unity and I tried to implement a volume slider. I can now adjust the volume, but the volume resets every time I try to load a new scene.

Could someone tell me how to transfer the volume to other scenes? I am using Unity 2018.3.14f1 and the code I am using for the volume is:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;

public class SetVolume : MonoBehaviour
{
    public AudioMixer mixer;

    public void SetLevel(float sliderValue)
    {
        mixer.SetFloat("MusicVol", Mathf.Log10(sliderValue) * 20);
    }
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Save It in PlayerPrefs, Then load it on Start or anywhere you need it.

public class SetVolume : MonoBehaviour
{
    public AudioMixer mixer;
     
    
    void Start()
    {
        SetLevel(PlayerPrefs.GetFloat("MusicVol"));
    }

    public void SetLevel(float sliderValue)
    {
        PlayerPrefs.SetFloat("MusicVol", sliderValue);
        mixer.SetFloat("MusicVol", Mathf.Log10(sliderValue) * 20);
    }
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda