Search Unity

Instantiating particle system prefab causes stutter

Discussion in 'Prefabs' started by denlee0710, Jun 22, 2021.

  1. denlee0710

    denlee0710

    Joined:
    Mar 9, 2015
    Posts:
    36
    Hello all,

    I have particle system GameObject prefab(store bought asset), that even when in editor play mode, causes a sceen hiccup the first time this prefab is instantiated.

    I suspect it has something to do with one of the effect that uses texture sheet animation, of which the texture size is 2.7MB. This prefab in question is directly referenced in a ScriptableObject, and the SO was loaded using a Resources.Load call. Hiccup only happens during the instantiate call, which happens some time after the recource.load call.

    Don't all the depencies of an asset gets loaded when you call resources.load?

    I've thought of a solution involving pre instantiating it during load and hide it somewhere until I need it. But it's not feasible when the amount of particle effects textures that "could" be load in a scene gets bigger.

    Appreciate any help with this!
     
  2. pietrodenicola

    pietrodenicola

    Unity Technologies

    Joined:
    Dec 8, 2020
    Posts:
    43
    The "pre instantiating" is probably the way. And the instance can be kept hidden as long as not used. That would work but of course comes with a memory cost because the instance will have to be kept in-scene even if not used yet.