Search Unity

Question Raycast2D of enemy

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

  1. CapitanMorcillo

    CapitanMorcillo

    Joined:
    Apr 20, 2023
    Posts:
    1
    Hi,
    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:
    upload_2023-4-20_22-42-4.png
    And the Enemies:
    upload_2023-4-20_22-43-6.png
    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.