I have a problem with Physcis2D.OverlapCircle. In one tutorial i saw somebody use it as ground detector. I am trying to use it as something that checks if player is on top of a platform or not. What i did is i created empty gameObject on each platform. Then i put a script on it where i wrote:
public bool onTop;
public LayerMask whatIsTop;
public float topCheckRadius;
public Transform topCheck;
void FixeUpdate()
{
onTop = Physics2D.OverlapCircle(topCheck.position, topCheckRadius, whatIsTop);
if (onTop)
{
Debug.Log("Works!");
}
}
Then in inspector i put the empty GameObject as the topCheck.position, i put some value for the topCheckRadius and lastly i created a layer called Top and then i selected it in the WhatIsTop layermask.
But when i jump on the platform with player nothing happens.