- Home /
SendMessage has no receiver BUT the GO definitely has a script on with that function in it?
So, as the title says - sometimes my SendMessage calls suddenly stop working. If i replace the SendMessage and first getComponent of the same GO ... and then directly call the function it works again... this seems like a bug to me... any clues of what i'm doing wrong? thanks...
example...
if i replace line A) with lines B) then it works - using line A) i get the error - "SendMessage ChangeAtlas has no receiver"
A) outlineSprite.SendMessage("ChangeAtlas","ScampAtlas");
B)
UISpriteUtils spriteUtilsScript = (UISpriteUtils)outlineSprite.GetComponent(typeof(UISpriteUtils));
spriteUtilsScript.ChangeAtlas("ScampAtlas");
any ideas appreciated ;)
Answer by Ross_S · Nov 30, 2013 at 07:09 PM
Ahh... so this happens if the gameObject that you are sending the message to has multiple scripts on it with that function name... problem solved ;)