Use variable as binary save file name

Updated on March 14, 2020 in Unity
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on March 12, 2020

How can I use a variable as the name of a binary file?

 

FileStream fs = File.Create(Application.persistentDataPath + "/Items/+"MapName"+.dat");

 

simply escaping using quotes doesn’t work gives a squiggly line under the MapName.

 

Thanks in advance!

  • Liked by
Reply
1 on March 12, 2020

you have your quotation marks in the wrong place.

The ‘+’ should be outside them.

FileStream fs = File.Create(Application.persistentDataPath + "/Items/"+MapName+".dat");
on March 14, 2020

Thanks! That worked!

 

Show more replies
  • Liked by
Reply
Cancel