I am trying to send a int in between gameobjects

My code is:


using UnityEngine;

public class PianoKey1 : MonoBehaviour
{
void Start()
{
gameObject.SendMessage(“KeyPressed”, 1);
}
}


using UnityEngine;

public class WaveBar1 : MonoBehaviour
{
public void KeyPressed(int keyID)
{
print(keyID);
}
}

In Unity you usually do something like that by either using public variables or public functions.

I guess the first answer in this thread could help you.