CollidersGetColliderOfTypeT Method |
Returns a collider of the requested type or creates one if needed.
Namespace:
KSPDev.ModelUtils
Assembly:
KSPDev_Utils.2.5 (in KSPDev_Utils.2.5.dll) Version: 2.5 for KSP v1
Syntax public static T GetColliderOfType<T>(
GameObject obj
)
where T : Collider
Request Example
View SourceParameters
- obj
- Type: UnityEngineGameObject
Type Parameters
- T
Return Value
Type:
TThe found or created collider.
Remarks
This method returns the exact collider component if it exist in the
obj. However, if the object
doesn't have a collider, then a new one will be created. If the game object has a collider but its type is
incompatible, it will be deleted and a new compatible collider will be created. Note that the old collider, if
present, will be removed using the
SafeDestroy(Collider) method.
See Also