Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Explosion prefab freezes during game

Discussion in 'Editor & General Support' started by elias723, Apr 5, 2006.

  1. elias723

    elias723

    Joined:
    Feb 10, 2006
    Posts:
    178
    Hey everyone. I have built a game where explosions occur at suitable times, but when I run the built version, the first time the explosion particle system explodes, the game freezes up for a second or two. I have the particle system in the actual hierarchy because I wanted to modify a couple of settings in the system and make sure that it would load fine in the game, but that's not working. The only time it freezes is on the first explosion. If anyone has any insight into this problem, I would be very appreciative.
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Unity is loading the assets used by that prefab for the first time.
    You can avoid that stutter by preloading all assets used by the scene.

    To make sure that your scene preloads all assets, you usually make a loader scene (Displaying a splashscreen or menu) and then call Application.LoadLevel to load your real level.


    The player loads the first scene without preloading and all other scenes with preloading.

    (The first scene being the one that gets automatically loaded)
    We don't preload the first scene because it allows you to display the startupscreen as fast as possible.

    All other scenes (Scenes you load with Application.LoadLevel) are always preloaded completely.
     
  3. elias723

    elias723

    Joined:
    Feb 10, 2006
    Posts:
    178
    Ah - thank you. I've only been making single level "games" so far - that would explain it.