I have a script named Gun and it has a int called rpm. It is in multiple objects. I want to add a number to rpm to all of the objects it is in through another script. How would I go about doing this?
use static variables so in the gun script:
public class gun : MonoBehaviour {
public static int rpm;
}
and to access and use it from other scripts
public class OtherScript : MonoBehaviour {
private int otherrpm = gun.rpm;
}