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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Help with making a script for a 2d platformer enemy

Discussion in '2D' started by Zakuta, Dec 24, 2019.

  1. Zakuta

    Zakuta

    Joined:
    Dec 1, 2019
    Posts:
    2
    So I've just gotten into playing around with unity and started creating my own platformer, but now I need to make a script for my enemy that can detect when the player is near and attack the player and play an animation. I would appreciate any ideas or solutions that could help me reach this goal.
     
  2. Oddinx

    Oddinx

    Joined:
    Mar 2, 2017
    Posts:
    12
    Last edited: Dec 25, 2019
  3. TheHammer1

    TheHammer1

    Joined:
    Oct 15, 2015
    Posts:
    25
    You can use other casts if they suit your tastes better than a regular Raycast: