private void OnTriggerStay(Collider other) { if (other.gameObject.CompareTag("MagneticSphere")) { MagneticSphere ms = other.GetComponent <MagneticSphere>(); if (Input.GetKeyUp(KeyCode.Mouse0) && ms.isEnabled) { StartCoroutine(ms.Disappear()); StartCoroutine(ms.Recreate()); } } }
// Use this for initialization void Start() { magnet = (MagneticSphere) (gameObject.GetComponent("MagneticSphere")); }