#sure
1 messages · Page 1 of 1 (latest)
i think, if the function isnt getting ran, then the action isnt getting fired?
Invoke
the event is getting called no matter of the listeners
i know the function containing the invoke is ran
thats wrong
so to sum up because im kinda lost right now
you are subscribing to the event in OnAwake
which you call in Awake
SaveDataLoaded?.Invoke(saveData);
its ? internal null check
let me remove that and see if i get an error
yea was about to suggest that
yep, i get an NRE on that line
I spawn my player at runtime, and the subscribers are on the player
How do i do that?
let me think
we've narrowed it down to a race condition though for sure
im 99% confident
perhaps i should turn
public void LoadSaveData(ref PlayerSaveData saveData)
{
if (File.Exists(gameSavePath))
{
if (EnableEncryption)
{
string plainJsonText = EncrptionSerializer.DecryptTextFromFile(gameSavePath);
saveData = JsonUtility.FromJson<PlayerSaveData>(plainJsonText);
}
else
{
saveData = JsonUtility.FromJson<PlayerSaveData>(File.ReadAllText(gameSavePath));
}
// invoke delegate to notify subscribers that saveData has changed
SaveDataLoaded.Invoke(saveData);
Debug.Log("Load Save is ran.");
}
}``` this isnt a coroutine and `WaitUntil` there is a subscriber?
if thats possible
i mean that might work
but idk how to check if there is any subscriber
idk if you can??
google suggests i just check if its null or not
i cant even seperate it out i just thought, since i'd still need to pass ref to it
make a coroutine that waits untill the subscrber then calkl the LoadSaveData
ping me if you solved it
@twin steppe Looks like its working, I have many more issues now though so need to fix those before verifying