The exact error popping up on my unity console is: ArgumentNullException: Value cannot be null.
Parameter name: collider
The exact line the error is on is "col.OverlapCollider(nonPlayer, colliders);"
Which is extremely confusing to me. Also for further information the layer mask NPC is properly defined in earlier code and I have the seem problems even when i keep the contactFilter not having any specific parameters. On top of this the same error occurs even when i set col.OverlapCollider(nonPlayer, colliders); equal to an integer. as in: int h = col.OverlapCollider(nonPlayer, colliders);
public void Attack(Collider2D col, float stagger) //deals with the physical attack of the weapon and it's interaction with Characters
{
ContactFilter2D nonPlayer = new ContactFilter2D()
{
};
nonPlayer.SetLayerMask(NPC);
nonPlayer.useLayerMask = true;
List colliders = new List();
col.OverlapCollider(nonPlayer, colliders);
Debug.Log("hits : " + colliders.Count);
for(int i = 0; i < colliders.Count; i++)
{
colliders[i].gameObject.GetComponent().ReceiveDamage(usedDmgTypes, usedDmgValues, stagger, player.is_FacingRight);
Debug.Log("we made it?");
}
}
If this is also helpful the error also gave out this information:
UnityEngine.PhysicsScene2D.OverlapColliderList_Internal (UnityEngine.Collider2D collider, UnityEngine.ContactFilter2D contactFilter, System.Collections.Generic.List`1[T] results) (at :0)
UnityEngine.PhysicsScene2D.OverlapCollider (UnityEngine.Collider2D collider, UnityEngine.ContactFilter2D contactFilter, System.Collections.Generic.List`1[T] results) (at :0)
UnityEngine.Collider2D.OverlapCollider (UnityEngine.ContactFilter2D contactFilter, System.Collections.Generic.List`1[T] results) (at :0)
Weapon.Attack (UnityEngine.Collider2D col, System.Single stagger) (at Assets/Scripts/GeneralParents/Weapon.cs:395)
↧