#Debug attempt

1 messages · Page 1 of 1 (latest)

vagrant relic
#

Yo send here

north garnet
#

So to start it off

#

I have some data that is stored on my pc via serializing

vagrant relic
#

okay

north garnet
#

when loading the game i check if the data exists

#

which if this file exists or not, sets it to a new one or uses the file

#

In the research (where the bug is) i set some variables

#

these are the values

vagrant relic
#

mkay

north garnet
#

its about the research costs

#

it creates an array of the costs

#

so it should create an array that looks around [100, 220, 356, 478] blah blah

vagrant relic
#

right

north garnet
#

but i had a function earlier that made an array like [2, 4, 6, 8 ,10] for the costs

#

because of a different currency

#

but when i delete the save file (so it resets

#

and i check the values

#

it is still the old array

#

if i replace the Enum with the enum value

vagrant relic
#

oh

north garnet
#

like this

#

so just replacing it with the value

#

then delete the save file again

#

to reset

#

and play the game again

#

it updates to the correct values

#

but if i put back the research enum

#

which is the exact same

vagrant relic
#

that is rlly weird

north garnet
#

its goes back

#

and i am so baffled

vagrant relic
#

wtf

north garnet
#

i tried restarting unity and everything

vagrant relic
#

that is so friggin weird I got no clue why that would be sorry

north garnet
#

yeah me neither

#

thanks for listening anyways

#

that clears my mind a bit atleast

vagrant relic
#

yeah, sorry I was of literally no help

north garnet
#

no no

#

you are all good

#

thank you for listening

#

And also, just to show i didnt forget to save

#

if i change it to this

#

it does update

#

but if i then change it back

#

it goes back to what it was

still swift
#

okay so what is serializing?

north garnet
#

a way of storing data

#

its just to show that its not because of that

still swift
#

so you are making a list in a text file, where each line stores information for a new element?

north garnet
#

its a .dat file

#

so it looks like this

#

but that all functions

still swift
#

I just read that you can sore stuff on a file using
string content =JsonUtility.ToJson(yourList);
and then
File.WriteAllText("YOURFILE.Dat",Json);

and then for reading you'd use
string content=File.ReadAllText("YOURFILE.Dat",Json);
List<int>yourList=JsonUtility.FromJson<List<int>>(Json);

north garnet
#

yeah thats what i do

#

and that works

#

but my enum file wont "update" properly

still swift
#

what does your enum file do?

north garnet
#

store my enums

glossy trail
#

I see bunch of statics

north garnet
#

Yeah

#

Because they shouldnt change after i have set them

#

That shouldnt be an issue

glossy trail
#

That is an issue, static does not mean persistent

north garnet
#

I can try

glossy trail
north garnet
#

I will next time, my bad

#

Il try and see if this works first

#

I mean it sort of works

#

but how do you suggest my enum files look like otherwise?