Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Getting gameobjects in overlapcircle

Discussion in 'Scripting' started by gplay1863, May 13, 2023.

  1. gplay1863

    gplay1863

    Joined:
    Jun 11, 2021
    Posts:
    2
    I have a creature script that finds food nearby does anyone know how can I get game objects that are in the OverlapCircle


    ```cs
    void CheckForFood() {
    if(Physics2D.OverlapCircle(transform.position, foodSearchRadius, foodMask)) {

    }
    }
    ```
     
  2. seejayjames

    seejayjames

    Joined:
    Jan 28, 2013
    Posts:
    685
  3. gplay1863

    gplay1863

    Joined:
    Jun 11, 2021
    Posts:
    2
    Oh, Aight Thanks!