Does SendMessage work with built-in components, like ParticleSystem and AudioSource? It seems like the answer is no…but maybe I’m doing something wrong in my code?
For example, if I want to send “Play” to a particle system…it doesn’t seem to work, unless I slap on a dumb component that looks like this:
function Play()
{
GetComponent(ParticleSystem).Play();
}
As alucardj pointed out in the comment above SendMessage works only for MonoBehaviours and built-in components are not derived from MonoBehaviour.
Also it will try to call that method on ALL MonoBehaviours on that GameObject, so if you want to call a funtion of a specific Component you are better off using the old-fashioned function calling.
However, most built-in components will have a property, so instead of GetComponent.Play() you can just write particleSystem.Play() or from the “outside” (from another script) myObject.particleSystem.Play().