void OnCollisionEnter2D(Collision2D collision) { CharacterType type = collision.gameObject.GetComponent <Controller>().Type; if (type == targetType) { if (targetType == CharacterType.BigCube) { handler.ResetBlueCube(); } else if (targetType == CharacterType.SmallCube) { handler.ResetRedCube(); } else { print(string.Format("This shouldn't ever display. TargetTag={0}", targetType.GetID())); } } }