- Home /
.exe and _data files related to project after build
Hello guys, I ve made a simple 2D game, and I wanted to build it. Everything seemed normal, and the game works, but I found out some aspects that are really annoying:
I think that my "Game.exe" or my "Game_Data" folder are someway related to my unity project. I use PlayerPrefabs to store some values about the place where I want my player to spawn (like Checkpoints), and if I reach a new checkpoint on my unity project, that gets reflected on my .exe game, so when I try to run it, my character appears on the checkpoint I ve just reached on the game inside my project.
I cant run the game on other computers as well, as I get some kind of loop that kills and spawns my player continuously (I think that's a consecuence of what i said on the previous paragraph)... How could I fix that?
Thanks in advance
Answer by MyCatFishSteve · Apr 17, 2014 at 08:06 PM
When dealing with PlayerPref's the data is stored on the registry and at the same location, this means that both the Editor and Standalone will access the registry at the same location for the data. If you want to solve this problem, I would recommend looking at the System.IO namespace to create files and populate them.
using UnityEngine;
using System.Collections;
using System.IO;
public class Foo : MonoBehaviour
{
void Awake()
{
System.IO.File.Create("bar.cfg");
}
}
If you don't want to use the System.IO namespace, you can call the PlayerPrefs Delete All method whenever the game starts.
PlayerPrefs.DeleteAll();
RESOURCES: http://msdn.microsoft.com/en-us/library/system.io(v=vs.110).aspx
Your answer
![](https://koobas.hobune.stream/wayback/20220613142948im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
When I build and run my game my character and objects do not appear in the finished game 1 Answer
Unity is broken completely 1 Answer
Unity error when build (antivirus On) 0 Answers
WebGL loading on browser not working 0 Answers
cannot build player while editor is importing assets or compiling scripts 7 Answers