- Home /
Is it possible to update a TextAsset at run time in a build?
Hi, Unity community,
I am interested in knowing if it is possible or is there any work around to update the content of a TextAsset at runtime in a build, and then restart the scene to validate the new TextAsset?
I understand the TextAsset is being compiled into the build and there is no easy way of changing it, also TextAsset.text is read-only, is there any work around on this?
Thank you in advance!
For clarification: Currently I am creating a new object with a TextAsset attached to it. What I want to achieve is at the runtime of a build, I download a new TextAsset from the server, save it in persistent data path and then replace the original one with the newly updated one.
The problem is I think TextAsset is compiled into the scene at compile time and there is no easy why of using a "set" function in the object to set the TextAsset to the new one saved in persistent data path.
I am wondering if there is any method that can achieve "update TextAsset" feature?
Not quite clear to me what you're asking but if you just need to be able to edit/save/load some text, you could write it to a file in persistentData.
Thanks for your reply. Currently I am creating a new object with a TextAsset attached to it. What I want to achieve is at the runtime of a build, I download a new TextAsset from the server, save it in persistent data path and then replace the original one with the newly updated one.
The problem is I think TextAsset is compiled into the scene at compile time and there is no easy why of using a "set" function in the object to set the TextAsset to the new one saved in persistent data path.
I am wondering if there is any method that can achieve "update TextAsset" feature?
Thank you in advance!
Sorry, it's still not clear to me. I'm not sure what you mean by "attaching a TextAsset to an object". If you have some text that you need to be able to update permanently, then you can 1) copy it from the build to a simple text file on first launch 2) load from that text file on setting up the scene(s) that use it and 3) update that text file at runtime if required. Is there some reason that's not going to work?
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Resources.Load doesn't work at runtime 0 Answers
My coroutine ends when i initialize a postprocessing setting 0 Answers
RI.Hid Is Driving Me Insane 1 Answer