Search Unity

Creating and destroying objects.

Discussion in 'Android' started by TIGGYsmalls, Sep 26, 2013.

  1. TIGGYsmalls

    TIGGYsmalls

    Joined:
    Jan 10, 2013
    Posts:
    38
    I have my game in a sort of finished state but I just have problem with creating and destroying objects making the frame rate skip on my S3 Mini.

    None of the objects are more than 280 polygons and the largest textures are 512. The game gets to about 1.1k polygons on screen. It runs smooth.

    But every time the new object is loaded from my prefabs it will skip a few frames weather it has any scripts associated with it or not. Doesn't seem to happen with particles though.

    I was just reading this: http://sicklebrick.com/?p=411

    I am going to run though the tips to see what helps but I was wondering if anyone has any suggestions?
     
  2. MightyRobot

    MightyRobot

    Joined:
    Sep 25, 2013
    Posts:
    35
    A good idea is to instantiate your objects at the beginning of a scene, and leave them somewhere where they can not be seen until you need them.
     
  3. TIGGYsmalls

    TIGGYsmalls

    Joined:
    Jan 10, 2013
    Posts:
    38
    What about if you need 10 of each item? Just have 10 instances?

    Creating an object that's in the scene makes it jump less but its still noticeable.
     
  4. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
    Yes. If you don't need to have all of them visible at the same time, you can recycle them.