1
\$\begingroup\$

I've created with Unity a short demo that works as a standalone .exe on Windows, and I was interested in deploying it as a web player game too.

When I run the game on the web player, though, I get this error in the Unity console:

StreamingAssets is not available on this platform.

I have some XMLs I parse at runtime in the StreamingAssets folder. Where can I put them in a web player build so to be able at runtime to load them?

Thanks for your answers.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Found a solution so to use the same code for both Windows and Web Player deployment (disclamer: I'm just reading these XML files): you can put the XMLs in the Resources located into the Project Assets folder. This basically tells to Unity to keep these files into the final build and you can load them at runtime using (in case of xmls for example):

XmlDocument doc = new XmlDocument();
TextAsset myXmlAsset = Resources.Load<TextAsset>("myXml");
doc.LoadXml(myXmlAsset.text);

I hope this helps someone :)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .