|
I'm trying to send a message from a coin prefab to a score gui to add 1 to the score everytime my player collides with a coin. Here's the coin script:
Here's the score gui's script:
Does anyone know what's wrong here?
(comments are locked)
|
|
SendMessage "calls the method named methodName on every MonoBehaviour in this game object." OnScore() won't be found unless it's on the Player object, and by the sounds of things it isn't.
(comments are locked)
|
|
The idea looks sound.
Use the debugger or put a Debug.Log line at the top of the OnTrigger function to make sure it is getting called. If it is, then the test for player tag is failing. If it isn't, then the problem is with getting the trigger to fire.
(comments are locked)
|

The error reposrt is saying that OnScore has no receiver..
I am not able to run Unity where I am... is there a version of SendMessage that takes just a method name? I cant remember. It might be getting confused thinking it should be looking for a method with one argument (that happens to be set to null in your case). Try that or add a bogus float to the method. I'm pretty sure reflection is used to look up the method name.