I have a text file that I’m reading in from the Resources folder to get information to be displayed in my Unity project. The plan was to have the text file with the published package to be able to change the text when we need to and have it update easily.
When I publish the package, there is no text file put in the Resources folder. When I put the text file in there and change something to test it, nothing happens.
Why doesn’t this work? Is there another way you’re supposed to do it?
Yup, that’s what I’m doing. File is in my Asssets/Resources folder when developing.
public string xmlToLoad = ""; // XML text file to load
TextAsset xmlText = Resources.Load<TextAsset>(xmlToLoad); // Load XML text file into a TextAsset
tempString = xmlText.text; // Assign the TextAsset to a string to be processed.
It works when I’m inside Unity developing, and it keeps the information when I build the project, but if I add the XML file to the "[PROJECT}Data\Resources" folder and change something, it doesn’t update the text in the game.
You may want to re-read those sources then. Resources is the old method of streaming assets that are already built into the game during runtime. None of them will mention it supporting post release content additions and the documentation sure doesn’t. When they say ‘put in a folder name Resources’ they only ever mean a folder within the Assets directory of your Unity project.
Those files you see in the Resources folder of a built game are just manifests pointing to assets within the resources.assets file in the game’s main directory if I remember right.