I’m working on a project that requires me to read in a large number of coordinates and create representations of them. I’ve done this by creating a script which strips CSV files and instantiates from a prefab. However, I’m developing this as a mobile application- and thus, I won’t actually have access to the CSV files locally when I try to export and run the project.
It would be very difficult for me to move the CSV files with the project, so now I’m wondering if there is some way that I could transfer all of the instantiated objects to a scene where they exist on their own, without having to be instantiated by a script.
I’ve looked at serialization, and its potential for loading, but before I dive deep into that I want to know if I’m even barking up the wrong tree. Could anyone give me a word of advice on this? I would very much appreciate it!
I’m not sure I see the difficulty here (unless this is a licensing issue or something). Have you looked into using the StreamingAssets folder for this? You can put your file into the StreamingAssets folder, and you will be able to use System.IO based classes to load the data (line by line if need be) using Application.streamingAssetsPath + “/yourfile.csv”
If it won’t take you much longer, it sounds like deserializing from the CSV at runtime would be better than creating scenes. It allows greater flexibility and control. (Example: In the future, you could make it only instantiate objects within X units of the camera for an open world type thing. Or, it’d be easy to convert this to download new scene layouts from the web - just point the load function to a downloaded/cached file instead.) Additionally, unless there’s lots of extraneous information in your CSV’s, they’ll have smaller file size than the scene file.