- Home /
Refresh/Reload Model From Assets Folder Each Frame?
Hey, this should be a pretty basic question. I want to, at least currently manually, edit a basic obj from a text file. I want to save it and instantly (the next frame after saving it) see it change in-game.
I'm sure there's a basic command that will update the model.
Please note I'm editing the file (again, for now manually) from the assets folder in my project. The assets have not been loaded into the project pane in the editor.
Thanks!
I have been doing a little bit of testing, and this appears to be automatic in the editor. Would this also work in a published game? And how would I access the file once it's published?
Answer by Paulius-Liekis · Jul 11, 2011 at 01:06 PM
Basically you can't. Editor reloads updated assets, Unity-Runtime-Engine doesn't (it uses assets which were imported during build time).
If you want to change models in runtime you have to make your own mesh format, update mesh somewhere on the server, so game-cleints can download it and construct updated meshes.
Answer by xortrox · Sep 14, 2012 at 06:16 PM
Actually, the assets get checked for changes once the window has been unfocused and focused again.
If you can somehow trigger these events using an external C# app you could force refresh assets sort of.
I don't know how this would work while actually doing stuff inside the editor simultaneously tho.
Answer by T de Rivaz · Aug 01, 2013 at 08:07 PM
If you are making an editor application that needs to do this. You can call UnityEditor.AssetDatabase.Refresh() This will instantly check to see if assets needs to be reloaded.
I did this for saving out a resources Text file that I wanted to reload back into the application. Although this will only work in the editor.