Help a new developer with storing a lot of 3D items!
Hello!
I am fairly new developer using Unity 4.6 for a university project. The idea of the project are to use Oculus rift Devkit 2 and leapmotion, in order to inspect and interact with a lot of 3D objects to learn more about them. This will give access to old artefacts without having to go to a museum where they are located today.
I have already done a previous project which used same hardware and software for a short game where you hit planes and collected points so I am not completely new.
However this task is a bit different and I am not sure where to start, hence I am reaching out to this community.
I will recieve 3D models from 3DS Max which are created by another group in the project. But I am not fully sure how the best way are to store all these artefacts and get them into the scene when the user desire to. We are talking about 200-300 items of different sizes and shapes.
My vision is to let the user select one artefact at a time, either from a list or by walking up to them and select them for closer inspection. How would I store all these items for a optimal use and later on be able to have different "databases" in same concept?
Is it recomended that I import them all to unity and make them as prefabs and store them around in the scene? or should I use some sort of external database to then spawn them in when a user select items from a list? (I have experience with mySQL etc).
As you may understand this is still in the planning stage and so far I have just created a scene with a player which uses the Oculus rift and leapmotion and can move around in an open space.
Answer by Soos621 · Nov 11, 2015 at 06:32 PM
Prefabs is the way to go, you wouldn't want to import object on the fly because its 1 heavy on the engine, and 2 because you'd have to access an external server to download the objects at runtime. Just make a prefabs folder and organize it appropriately unless you want to generate the objects procedurally, then you could store a series of vector3's and generate the mesh on runtime (again very heavy on the engine)
Sounds good! you think its easier to keep them in the scene with a mesh then let the user walk up to them? or just let the player spawn in the prefabs when ever?
You should use an object pool here's a link to a free one it lets you add your prefabs to a reference list and it will instantiate them on the scene load, this way you can just move them into place without creating or destroying objects at runtime which is pretty heavy on the engine.
I don't think object pool is relevant in that matter. The OP mentioned 200-300 object of different sizes and shapes, a pool would be for item like bullets or enemies that are reused over levels.
Prefabs is no better than server, the only difference being the time to download and the dependency to the network connection and speed.
On the other hand, the server allows to add, modify or remove item without reshiping a new app. You can also keep the item on the server and store them on device when downloaded. You could use JSON to interact between the app and the server to indicate whether a new item is available or an old item was removed or modified. This allow a simple and fast communication since JSON is just a text file, so not really big.
Apart from the download, prefab and online asset are the same. Once you got the download done, you are dealing with the same things, one as it all done, the other needs all to be done, but the amount of resources in the end is the same.
If you know that your app will not change, and all items are meant to stay where they are, then mark them as static. This allows the engine to perform optimisations on rendering since it knows from the start they will always be where they should.
Wouldn't you need to import the meshes to the mesh collider and renderer at runtime if you downloaded from a server as well? If the object are in the scene on load those operations would all be called at the beginning and not at runtime, which should free up memory.
thats only if u need to move the objects around during runtime, if they are staying still then just build the map first and let it load altogether, slower beginning loading times is always better than your fps rate dropping out, i do actually really like this idea though. It would be really sweet to be able to visit museums virtually.
yeah! the objects will only need to be able to spin around and zoom by the user! I hope this project will help people around to see things they otherwise wouldnt have access to due to distance and imobilities etc! I will give EZ pooling a try and see!
i will agree with fafase that an object pool may be too much for what you need just keep that in $$anonymous$$d
Your answer
Follow this Question
Related Questions
AssetBundle dont saves in cash 0 Answers
Android PersistentDataPath UnauthorizedAccessException 0 Answers
How To Save and Load player position using Serialization? 0 Answers
How Do I Save An Instantiated Object? 1 Answer
Trouble loading game save data with BlazeSave after uploading a new Steam build 1 Answer