hey guys,
I’m working on a spell in a game that spawns a trigger collider, and anything inside the trigger has a temporary game object attached to it that immobilizes the enemy. The trigger collider is a spawned prefab that instantiates another prefab (the immobilizing prefab). Once the immobilize prefab is attached to an enemy as a child, it uses SendMessageUpwards( ) to cease movement in the parent’s game object.
The immobilize script works fine, and everything does what it is supposed to do, but i get an annoying error: “SendMessage SetMobile[the function] has no receiver”. Before using SendMessageUpwards I had directly accessed the transform.parent, but this gave me an error also. Based on the errors I’m getting, the immobilize prefab is somehow not recognizing the parent, but its effect still works on the parent. After a little bit of research, it seems like it might be an issue with the prefabs, but I couldn’t find exactly what is wrong.
Something to note is that when the immobilize prefab spawned on an enemy, the Immobilize.cs script would spawn disabled (unchecked in the inspector), but its code still took effect. I enabled the script using the trigger collider that spawns it, but there is no difference in the error messages.