- Home /
Question by
Phanou · Apr 11, 2018 at 08:56 AM ·
prefabruntimeinstantiate prefabloading file
Load and store prefabs at runtime from external directory
Hello
I try to manage manage dynamically prefabs that my application can load. How load at runtime some prefabs store in external repository of the application ?
Is "Resources.Load" can help me for this use case ? I don't know if prefab must be in Resources folder at compilation.
Can I use "File.Create" or "File.Open" to store and load prefabs with something like this code ? I don't know if prefabs can be serialize completely (3D object, position, texture, ...).
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/test.prefab");
bf.Serialize(file, save);
file.Close();
Thanks for your help :)
Comment
Answer by Phanou · Apr 11, 2018 at 01:56 PM
Thanks a lot @SkyAngel_AOG I find very simple exemple for create and load AssetBundle and all is ok for me :)