# Getting ParticleSystemRenderer in inspector

I have a component that manipulates the sorting order of a given renderer, for the sake of managing UI layering. It looks something like this:

public class ManipulateSortingOrder : MonoBehaviour
{
public Renderer Renderer;

public void DoManipulation ()
{
// Renderer.sortingOrder = some value
}
}


Now I want to plug a ParticleSystemRenderer into the Renderer field via drag and drop. I know I can get it via script using GetComponent, but whenever possible I like to supply dependencies using the inspector for the sake of testability, looser coupling, and generally writing as little code as possible.

That said, I can't seem to find the actual ParticleSystemRenderer component in any GameObject with a ParticleSystem. Dragging the "renderer module" (which I assume is some editor trickery disguising the actual underlying component?) doesn't seem to work. I've also tried looking at the ParticleSystem GameObject in debug mode in the inspector, but haven't seen a ParticleSystemRenderer component attached.

Is there a way to grab the ParticleSystemRenderer using the inspector, or is GetComponent the only way to go?

• Dragging the GameObject containing the ParticleSystem into the Renderer field, or clicking the circle icon at the right side of the field and selecting the object from the list both let me get the ParticleSystemRenderer. Is this not working for you? Sep 17, 2020 at 15:19
• @DMGregory crap, didn't think of those. Both worked. Let me know if you want to put down an answer, if you do I'll accept it Sep 17, 2020 at 15:28
• I'm at the office just now, so if you've got time to write up an answer, you have my blessing. :) Sep 17, 2020 at 15:42