F
F
Farawa2022-04-12 14:11:57
Unity
Farawa, 2022-04-12 14:11:57

How to get material from ParticleSystem?

62555e2de3007358708384.png
there is such an object with particles, how to get the material attached to it from the code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2022-04-12
@Farawa

We click on the Renderer block, in it the item is Material, it should stand out in the assets. Or the material itself is visible below, right-clicking it, Select Material - it should also stand out in the assets.
Via script:

var pr = particles.GetComponent<ParticleSystem>().GetComponent<Renderer>();
Debug.Log(pr.sharedMaterial.name);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question