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 Raycast2D of enemy

Discussion in 'Getting Started' started by CapitanMorcillo, Apr 20, 2023.

  1. CapitanMorcillo


    Apr 20, 2023
    I have a problem with the patrol of one of my mobs in my project of "2d castlevania". Im new in unity and dont know the diferent about my enemies. I make a RayCastHit2d to see where is the final of the platform. My Slime works alright but my skeleton doesnt want to stop and change his direction.
    The code is this:
    And the Enemies:
    I give my a parameter the transform of the object "ComprobacionSuelo" = g_ControladorSuelo and the distance of the raycast.
    If you can help me i will be very gratefull :)

    PD: I created the slime with a prefab and the Skeleton with a PNG and sprites the animations.