SendMessage has no Receiver

in one of my scripts im trying to sendmessage to an animation object.

public GameObject animationObject;


and obviously i have the function in a script attached to the animation object

public void DoThis(){

the animationobject is a prefab that’s dragged into the GameObject so i can access and send the message. why am i getting the error that there is no receiver for it?

i’ve found this previous question

but im not sure what my problem is and how to fix it.

You can send message to the object inside the scene not to a prefab, since it doesnt exists in the scene hierarchy. In this case you have to save the object reference like this when you instantiate and call the sendmessage.

public GameObject animationObject;

GameObject _spawnedObj;

void Start()
   _spawendObj =  Instantiate(animationObject) as GameObject;

//and somewehre in code ...