Search Unity

Loading mesh at runtime via script

Discussion in 'Scripting' started by Diego Colombo, Nov 2, 2006.

  1. Diego Colombo

    Diego Colombo

    Joined:
    Aug 24, 2006
    Posts:
    3
    Maybe it's a stupid question ... give me the answer anyway :)

    I would like to load and unload object during a level, i would like to do this in a large level (large by spacial means) and i would like to load and unload object and object LOD, is there a way to serialize and deserialize object when i like ti most with a script?

    Thank you.
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Yes, that is possible. An example of similar functionality is the MeshSerializer script on Unify wiki.

    However, the question is whether that's the correct thing to do. Objects that are in the level but are inactive don't consume processing power, only some memory (which is probably swapped out by OS if not used for long periods). What I suggest is not loading/unloading things at runtime, but just activating/deactivating them. That is much simpler to implement and might work just as well.