void OnTriggerExit(Collider other) { SVRA_InteractiveObject component = ValidActiveComponent(other.gameObject); if (component == null) { return; } collidingObjects.Remove(component); }
/* Determine if a GameObject contains the SVRA_InteractiveObject script */ SVRA_InteractiveObject ValidInteractiveComponent(Transform transform) { if (transform == null) { return(null); } SVRA_InteractiveObject component = transform.GetComponent <SVRA_InteractiveObject>(); if (component != null && component.enabled) { return(component); } return(null); }
/* TODO: Look this code over and possibly make it recursive */ /* Verify that a GameObject contains the SVRA_InteractiveObject script */ SVRA_InteractiveObject ValidActiveComponent(GameObject gameObject) { // On Destroy() a GameObject may set to null occasionally so handle that case if (gameObject == null) { return(null); } SVRA_InteractiveObject component = ValidInteractiveComponent(gameObject.transform); if (component == null) { component = ValidInteractiveComponent(gameObject.transform.parent); } if (component != null) { return(component); } return(null); }