//Set the callback function to run when tapped on void Start() { NetworkedTappable script = gameObject.GetComponent <NetworkedTappable>(); if (script != null) { script.onActiveCallback = OnActiveChanged; } else { Debug.LogWarning("ChangeColourWhenActive must be on an object with a NetworkedTappable component"); } }
public bool resetWhenNotActive = false; //set to true to revert the gravity back to the initialGravity when not active //Set the callback function to run when tapped on void Start() { NetworkedTappable script = gameObject.GetComponent <NetworkedTappable>(); if (script != null) { script.onActiveCallback = OnActiveChanged; } else { Debug.LogWarning("ChangeGravityWhenActive must be on an object with a NetworkedTappable component"); } gameObject.GetComponent <Rigidbody2D>().gravityScale = initialGravity; }