Search code examples
unity-game-engineparticle-system

why I cant choose stretched_billboard render mode in the script?


I am trying to change particle render mode in the script but I cant choose stretched_billboard mode but it is possible to change in the editor.

ps = GetComponent<ParticleSystem>();
psr = GetComponent<ParticleSystemRenderer>();
psr.renderMode = ParticleSystemRenderMode.Stretch;

this works fine

psr.renderMode = ParticleSystemRenderMode.StretchedBillboard;

there isn't StretchedBillboard option.

Thanks in advance.


Solution

  • I think that StretchedBillboard is a combination of the default renderer model (Billboard) and a non-zero scaling applied to the camera. So, through code, you should be able to reproduce it with a combination of these two values.

    In fact, look at the documentation, stretched billboard is explained as the billboard mode, but with the applied scaling:

    enter image description here

    Looking at the ParticleSystemRenderer's APIs, there's the cameraVelocityScale attribute (How much are the particles stretched depending on the Camera's speed.). There's also a snippet that should give a proper example.

    I hope this could help you out.