Sprite Factory

ReadMe
Release Notes
Overview
Using the Editor
Upgrading

Concepts
Sprites
Master Sprites
Sprite Groups
Colliders
Locators
Material Sets
SpriteUpdater
SpriteCamera

Advanced
Working in Multiple Projects

Classes
Runtime Classes

Videos
Overview
Creating Sprites
Sprite Inspector
Frame Events
Collision System
Locator System
Material Sets

Links
Sprite Factory Site
Web Documentation
Support
Contact

SpriteFactory.ColliderInfo.GetCollider

C#: TCollider GetCollider<TCollider> ()
JS: function GetCollider.<TCollider> () : TCollider

Description
Generic function. Get the collider cast to a specific type. TCollider must be derrived from either Collider or Collider2D.

Example:

C#

ColliderInfo colliderInfo = sprite.GetCollider("HitCollider"); // get the collider from the sprite
if(colliderInfo.is2D) { // this is a 2D collider
    if(colliderInfo.type == ColliderType.Box) {
        BoxCollider2D box2D = colliderInfo.GetCollider<BoxCollider2D>(); // get the collider cast to the proper type
        // do something
    }
} else { // this is a 3D collider
    if(colliderInfo.type == ColliderType.Box) {
        BoxCollider box = colliderInfo.GetCollider<BoxCollider>(); // get the collider cast to the proper type
    }
}