OK, you are using code from another thread to manage your state, I’m not going to get into that code.
I don’t uderstand what you mean by
on the other hand if I turn off the app
it no longer displays the old score
What old score? If you are loading your serialized score data at start up, then that’s what it should be showing…
1 Like
Hello
for example if I end a game
I close the application
if I restart the application and a new part
the high score is not displayed at startup
as if it does not exist in the xml
carrying the call in the loadContent
how did you go about opening the xml file i can’t find it?
just to see
wearing I know it exists and that I write well in it
Sorry for the inconvenience
thank you
it works perfectly
I had a line of code that calls a new scoremanager
thank you very much for everything
Great
1 Like
it works on the virtual device but not on the smartphone
is this a history of the file location on the system?
or when it tries to load xml it cannot find it because it is not yet created?
it’s this code if (! File.Exists (_fileName))
returns a new ScoreManager ();
when i removed this code it works in virtual but not in real
does this mean that the file does not exist or because it is not yet created? and these 'for what creates a new void?
if (!Directory.Exists($"{_fileName}/SaveData"))
Directory.CreateDirectory($"{_fileName}/SaveData");
if (!File.Exists(_fileName))
return new ScoreManager();
Can you see the difference in what _fileName is on either the virtual or physical? I don’t know why you are having this issue, the method(s) I have described work fine for me both in the emulator and on my S10.
1 Like
thank you for the answer I misspoke after the modification it works in virtual but I can’t install it in physics it tells me there is an installation problem
The application is installed, but at launch it shows me
the application has stopped
the launch screen is displayed after the app stops
Are you putting break points in and running it in debug?
in debug it works it is when starting the app that it stops
it’s strange normally it should work since it works on the simulator
is there a way to check in release mode? have the impression that it cannot find the xml file in the physical memory?
So, when you run it from VS on the device, what are you seeing?
when I run on VS everything works perfectly
it shows me the best scores even if I turn off the application
Odd.
So, running it on the device via VS is fine, but then run it on the device and it fails to load?
Yes that’s right this is the only modification I made suddenly I think that it comes properly from loading
Then I have no idea how to resolve that, it should not make any difference…
Try wrapping the area you think is the issue in a try{} catch{} and render the exception message to the screen.
1 Like