CSV file no longer working as intended after build.
This is my first Unity project so I am still getting used to both C# and Unity. I am creating a simulator game that uses a CSV file to hold attributes and stats of different characters. The function reads through the CSV files and splits each line into an array that is used when the characters are randomly selected.
StreamReader strReader = new StreamReader("Assets\\Sets\\PlayerAtts.csv");
bool endFile = false;
while (!endFile)
{
string AttsData = strReader.ReadLine();
string[] plAtts = AttsData.Split(new char[] { ',' });
Once I built the game the game would work as intended but skip certain functions and then eventually just break as it fell onto a part of the simulator that relied on the CSV file. I then ran a dev build which would either say that it couldn't find the CSV file in the path or there was a null reference error. I have sort of fixed this by adding the CSV file to the build folder after it has been built but I would like to keep the character stats hidden from all players.
Any help is appreciated.
Answer by unity_QPtxvhvUqsNBuw · May 12, 2020 at 08:55 AM
I sort of fixed this using StreamingAssets and then manually setting the StreamingAssets folder to hidden once I built the game.
Your answer
Follow this Question
Related Questions
Flight Sim help 1 Answer
Can android device interact with the pc unity game? 2 Answers
How does one make a train in Unity? 0 Answers
tvOS remote controller button, simulator,tvOS remote controller buttons, simulator 0 Answers
Polymorphic array inside ScriptableObject,Polymorphic array in ScriptableObject 0 Answers