Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to access ParticleRenderMode of particle system?

Discussion in 'Scripting' started by hellcaller, Apr 22, 2016.

  1. hellcaller

    hellcaller

    Joined:
    May 19, 2010
    Posts:
    381
    trying somth like
    Code (CSharp):
    1. particleSystem.GetComponent<Renderer>().ParticleRenderer.ParticleRenderMode = ParticleRenderMode.Stretch;
    But it doesn't work, am i reading the docs in a wrong way?
     
  2. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    Code (csharp):
    1.  
    2.         // particleSystem.GetComponent<Renderer>().ParticleRenderer.ParticleRenderMode = ParticleRenderMode.Stretch;
    3.         // GetComponent<Renderer>() unnesessary because you're trying to access the ParticleRenderer component.
    4.         // There is no ParticleRenderer property in Renderer
    5.         // the particleRenderMode property has a lowercase p, like all others in Unity.
    6.         particleSystem.GetComponent<ParticleRenderer>().particleRenderMode = ParticleRenderMode.Stretch;
    7.  
     
    hellcaller likes this.
  3. hellcaller

    hellcaller

    Joined:
    May 19, 2010
    Posts:
    381
    awesome! thnx
     
  4. hellcaller

    hellcaller

    Joined:
    May 19, 2010
    Posts:
    381
    Unfortunately it says:
     
  5. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    Well, do you have a ParticleRenderer there?
     
  6. hellcaller

    hellcaller

    Joined:
    May 19, 2010
    Posts:
    381
    sure thing! mbe they've changed API in 5.4?
     
  7. hellcaller

    hellcaller

    Joined:
    May 19, 2010
    Posts:
    381
    Ok got it :
     
    Last edited: Apr 22, 2016
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,796
  9. hellcaller

    hellcaller

    Joined:
    May 19, 2010
    Posts:
    381
    yeah got it, but when u're googling unity particle system components 90% of info refers to legecy system :(