hi to all, i have an issue passing data trough scenes: in the 1 scene i pass a value nameTatticToLoad to LoadDataManager, then i call a scene and i want that LoadDataManager will do some staff and i think i did the right tinks
The problem is that in the new scene in the ispector i see the value nameTatticToLoad in LoadDataManager, but if i Debug.Log("nameTatticToLoad: " + nameTatticToLoad) i get nameTatticToLoad is empty.
this is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadDataManager : MonoBehaviour
{
private static LoadDataManager dataManagerInstance;
public static LoadDataManager current;
public string nameTatticToLoad;
private void Awake()
{
current = this;
DontDestroyOnLoad(gameObject);
if (dataManagerInstance == null)
{
dataManagerInstance = this;
}
else
{
DestroyObject(gameObject);
}
}
public void passNameTattic()
{
Debug.Log("Call passNameTattic");
Debug.Log("nameTatticToLoad: " + nameTatticToLoad);
if (this.nameTatticToLoad != "")
{
Debug.Log("nameTatticToLoadENTERRRR");
UIManager.current.fileName = nameTatticToLoad;
UIManager.current.LoadMove();
UIManager.current.PlayAction();
}
}
}
i don’t understand why i never see the Debug.Log(“nameTatticToLoadENTERRRR”) like this.nameTatticToLoad != “” is alway false also if i see the value in the ispector
thz for help