Ok. So I have a problem with communication between two scripts.
First I’m sending you the part of my first script below:
Glass.GetComponentsInChildren<Force>().Operation(col.gameObject.transform);
In this script I have a variable of type GameObject called “Glass”. I’m using it to call my functions from other script which are attached to Glass’s childrens. These scripts are called “Force” and they have a “Operation” method which have a argument of type Transform.
Below my function in script “Force”:
public void Operation(Transform Direction)
{
Debug.Log ("Function called");
float Force = Random.Range(5f, 10f);
rigidbody.AddForce(Direction.forward * Force, ForceMode.Impulse);
}
All is going well but when I’m playing the game I have a warning:
Type ‘Force’ does not contain a definition for ‘Operation’ and no extension method ‘Operation’ of type ‘Force’ could be found (…).