Author Topic: Particles in Unity 5  (Read 2561 times)

greyhoundgames

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
Particles in Unity 5
« on: April 08, 2015, 04:49:18 PM »
So I used a workaround I found that puts particles infront of NGUI. I add a component that does this:
  1.         Renderer ren = GetComponent<Renderer>();
  2.  
  3.         if (ren == null)
  4.         {
  5.             ParticleSystem sys = GetComponent<ParticleSystem>();
  6.             if (sys != null) ren = sys.GetComponent<Renderer>();
  7.         }
  8.  
  9.         if (ren != null)
  10.         {
  11.             mMat = new Material(ren.sharedMaterial);
  12.             mMat.renderQueue = renderQueue;
  13.             ren.material = mMat;
  14.         }
  15.  

It was working fine, but I noticed it now no longer works. I am wondering if its related to upgrading to Unity5.
Things I have tried:
In the particle system itself, change the render layer field(new to unity 5 perhaps?)
Make a panel just for the particle and put it at a higher render priority http://www.tasharen.com/forum/index.php?topic=7216.0
The originally mentioned code
Another person's component based solution
  1. int rq = widgetBehindMe.drawCall.renderQueue + 1;
  2. foreach (Material material in m_renderer.materials)
  3. {
  4.   material.renderQueue = rq;
  5. }
  6.  

None of these seem to work for me anymore.
Thoughts?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Particles in Unity 5
« Reply #1 on: April 09, 2015, 03:48:23 PM »
http://www.tasharen.com/forum/index.php?topic=12837.0

In short, it sounds like Unity 5 just broke some backwards compatibility.