123456789101112131415161718192021 |
- using UnityEngine;
- using System.Collections;
- public static class ExtensionCollider
- {
- public static void SetCollider(this Component comp, bool active)
- {
- BoxCollider2D collider = comp.GetComponent<BoxCollider2D>();
- if (collider)
- {
- collider.enabled = active;
- }
- }
- public static void SetCollider(this GameObject gameObject, bool active)
- {
- gameObject.GetComponent<BoxCollider2D>().enabled = active;
- }
- }
|