Key.OnTriggerEnter2D C# (CSharp) Method

OnTriggerEnter2D() public method

public OnTriggerEnter2D ( Collider2D coll ) : void
coll Collider2D
return void
    void OnTriggerEnter2D(Collider2D coll)
    {
        //Only allies can activate and ally cannot be holding another object
        if (coll.gameObject.tag == "Ally" && coll.gameObject.transform.childCount == 0)
        {
            this.transform.parent = coll.gameObject.transform;
            this.transform.localPosition = position;
            myCollider.enabled = false;
        }
    }
}