Example #1
0
    private void Awake()
    {
        //Finds a collision manager in the world. If found, adds this collider to the manager list.
        colliderManager = FindObjectOfType <ColliderManager>();
        if (colliderManager == null)
        {
            Debug.LogError("You need to have a collision manager in the scene!");
        }
        else
        {
            colliderManager.AddColliderToList(this);
        }

        //Finds a Custom Physics component on this object.
        physics = GetComponent <CustomPhysics>();

        //Sets the transform and scale of the collider the same size as the object.
        position = transform.localPosition;
        scale    = transform.localScale;
    }