- Home /
Load prefabs from users hard disk
Hello there.
I'm having this idea for a long time and I don't know if I can reach it. I will like to develop my videogame in final versión (.exe) with, let's say 3 playable characters, but with the optional way for the users to make other characters and including them into the game, which leads to more tan 3 characters.
The users would make a prefab of a GameObject adding the 3D model, an Animation component, scripts, etc. And then they would put the (.prefab) files in a folder like C:\Mods\ or [videogame_name]_Data\Mods\, and the game will load this prefabs and use them to grow the characters array.
So the point is how do I get to work a prefab stored in a external folder.
I'm using Unity 4.1.3f3 free. Thanks.
.Prefab files work with references. It would be a lot harder to make sure those references stay. $$anonymous$$y advice is create your own system for loading character data :)
$$anonymous$$aybe separating the objects in files ins$$anonymous$$d one (.prefab)? (first I get the 3D model eg. \$$anonymous$$ods\0\model\x.fbx, then the animations eg. \$$anonymous$$ods\0\anim\, etc). It feels more simple like you said, but I keep knowing a darn thing about how to get all these files and implementing them into the game.
It's not that easy. You need to also import all the assets referenced in the prefab. You need to make your own importer to be able to do it in builds.
Pretty much your only choice is to do it using your own system
If you have Pro, you can use asset bundles:
http://docs.unity3d.com/Documentation/$$anonymous$$anual/AssetBundlesIntro.html
Asset bundles are pretty much the only practical way to do this, other than writing custom asset importers. As previously mentioned, a .prefab file does not actually contain any data- it just tells Unity how to compose an object out of different assets it already has- and, moreover, in a build all that stuff is wrapped up into an archive so can't access external files in the way you need anyway.
Your answer