- Home /
SendMessage throwing "No appropriate version of 'UnityEngine.GameObject.SendMessage'
I'm getting a weird error with these very simple scripts and I'm not sure why. Basically I'm aiming to change a variable in a character movement script when my character "drinks coffee" with a simple SendMessage script in JavaScript:
function BoostStats(){
character.SendMessage("CoffeeBoost", jumpHeightBoost, walkSpeedBoost, runSpeedBoost);
}
It's giving me the following error: "BCE0023: No appropriate version of 'UnityEngine.GameObject.SendMessage' for the argument list '(String, float, float, float)' was found."
"character" is a gameObject that is being called and then found like this:
public var character : GameObject;
function Awake () {
character = GameObject.Find ("Character");
}
Attached to the character object is a C# CharacterMovement script with this method:
void CoffeeBoost(float jumpHeightBoost, float walkSpeedBoost, float runSpeedBoost){
jumpSpeed += jumpHeightBoost;
maxWalkSpeed += walkSpeedBoost;
maxRunSpeed += runSpeedBoost;
}
Any ideas as to why I might be getting this error? Is it a communication error with C# and Javascript, maybe? Any ideas would be much appreciated!
Answer by Dave-Carlile · Jul 14, 2015 at 06:31 PM
SendMessage has two overloads, neither of which support the parameters you're trying to pass.
Also, the target of SendMessage
can either accept 0 or 1 parameters, not 3.
Your answer
![](https://koobas.hobune.stream/wayback/20220611231156im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
How can i smooth out the rotation? 1 Answer
Implementing Counter-Movement 0 Answers
Help with movement script? 0 Answers
How could I implement diagonal movement in this code? 0 Answers