Yes and no, it depends on your workflow.^^ “Application.dataPath” basically means your game’s directory - when you build your project you will have your executable and 2 folders in your directory. One of those is “ProjectName_Data” - this is where “Application.dataPath” refers to.
So if you put your graph file in that folder, you can load it in your script with $"{Application.dataPath}/graph.bytes"
→ Unity - Scripting API: Application.dataPath
If you setup your StreamingAssets folder, unity will include that in your folder structure, meaning you don’t have to put your assets there manually.
To access that you should use “Application.streamingAssetsPath”.
→ Unity - Manual: Streaming Assets
In theory you could also put your serialized graphs in an assetbundle as a TextAsset and load them form there, and/or as you mentioned it download it from a server. ^^
→ Unity - Manual: AssetBundles
I don’t feel confident enough on giving you advice about how you should or should not do it. I was trying to emulate your solution and make it work with as little change as possible, sorry if I caused confusion. ^^’
Your code should work in the editor and the build if you make use of this change:
Although, as mentioned, you have to put your “GraphCaches” folder with the “GraphCache.bytes” file into your games directory after building the game. How you do it, wether by including it from the start for your users or updating it at runtime by downloading it from a server is up to you. ^^