Calling script functions from other objects doesn't work on mobile but it does in the editor

Just to be clear, everything works perfectly in the editor and I have no problems, so I don’t know what I can change.

This is the code in one script

			if(Input.GetKeyDown(KeyCode.Space) && canDoTrick){
				if(trickTime >= 1){
					scoreScript.SendMessage("addScore", points);


this is the code from the script i’m trying to call

	public void addScore(int num){
		score += num;

I actually didn’t use sendmessage before, before I had a variable of the script and I called it by assigning it in the inspector, but I tried switching it to sendmessage to see if that would work on mobile, but it didn’t.

Any ideas? I’ve really hit a wall here I don’t know what I can change because it works fine in the editor.

Try just calling scoreScript.addScore(points). I see no reason why either solution shouldn’t work.

Make a reference to object with this script attached and get component from it. Then using a variable (this reference) get access to this function.

public ScoreScript scoreScript;

void Awake ()
   scoreScript = GameObject.FindGameObjectWithTag ("your tag").GetComponent <ScoreScript> ();


if (Input.GetKeyDown (KeyCode.Space) && canDoTrick)
     if (trickTime >= 1)
        scoreScript.addScore (points);

Best way (at least for me) to access to game objects and then to components is by defined tag. Of course this is one of ways, you can access to it different, but SendMessage isn’t a good option.