Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class colisionRemove : MonoBehaviour
- {
- private void Start()
- {
- Debug.Log("start method ran");
- StartCoroutine(waitMethod());
- }
- private IEnumerator waitMethod()
- {
- Debug.Log("waiting");
- yield return new WaitForSeconds(10);
- removeMethod();
- }
- private void removeMethod()
- {
- Debug.Log("removing");
- Collider[] colliderArray = this.gameObject.GetComponentsInChildren<Collider>();
- if (colliderArray.Length == 0)
- {
- return;
- }
- for (int i = 0; i < colliderArray.Length; i++)
- {
- Collider collider = colliderArray[i];
- if (collider != null)
- {
- collider.enabled = false;
- }
- }
- Debug.Log("done");
- this.enabled = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement