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?