#what do you mean only one MuonCounter?

1 messages · Page 1 of 1 (latest)

split notch
#

I'm confused, what are you asking?

#

How do I word that differently?

#

Is there a possibility that another MuonCounter exists when you load a new scene? So does the scene contain a MuonCounter?

finite estuary
#

there's only one muoncpunter, and that one only exist the the stage selection scenes

split notch
#

What is calling LoadData/SavaData and when?

#

And to be clear, is the issue that _amountMuons resets when you load a scene or what?

finite estuary
#

well i tried to make the goalscript to call loadData but...

finite estuary
#

I don't know if it resets or jsut staying like the same number

split notch
#

You don't know?

finite estuary
#

I said I don't know if it resests or just staying the same 0 number

split notch
#

You said:

issue where a counter is not persisting across scenes
How do you know that issue exists if you don't check the value?

hollow shuttle
#

Does it reset when you load a new scene or some other time specifically?

split notch
#

And what do you mean by "counter" - is it MuonCounter, Counter, or the variable itself?

hollow shuttle
#

Highly likely your Singleton isn't proper (missing guards for instance) and simply creating new instances

finite estuary
hollow shuttle
split notch
#

I'm asking what you meant with "counter" in that specific question you asked on stackexchange

#

What is not persisting

finite estuary
hollow shuttle
#

When does it become zero again?

finite estuary
finite estuary
hollow shuttle
#

When does it become zero again?

split notch
#

Which changes MuonCounter.instance._amountMuons

split notch
#

I still don't know which one you are talking about. What is resetting

finite estuary
#

also, nothing is supposed ot reset of the muoncounter about how many of them you have touched

split notch
#

After you change scenes, type t:counter and then t:muoncounter in the hierarchy window's search to see how many of those you have in the scene(s)

#

From what I see it still does sound like you have multiple instances of either one, while there should always be just one

finite estuary
#

there are 3 muon objects in each gameplay scene,

i was told i supposed to also have instance = this in the counter script

split notch
split notch
finite estuary
split notch
#

That could be setting it to zero

#

I see you calling Counter.Instance.LoadData from GoalVictory.Start

#

This sets MuonCounter.Instance._allMuons to whatever you saved in PlayerPrefs

#

And I don't see you saving anything to playerprefs

#

Okay I see you calling SavaData from GoalVictory

finite estuary
#

yeah

split notch
#

Search for counter, muoncounter and goalvictory instances in your scene after the scene changes/when the bug happens

finite estuary
#

how can i search for counter, muoncounter and hoalvictory instances in my scene? in the gameplay scene?

split notch
#

You can search by type with t:typename

split notch
#

See how you have multiple muoncounters in the scene?

finite estuary
#

yeah

#

when i come back to the level select scene

split notch
finite estuary
#

hmm... in the muoncounter?

split notch
#

Sure

finite estuary
#

ok

#

well it seems to be working, almost, because missing (TMP_Text)

#

and since the ui text is in canvas

finite estuary