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

Question Problem with field of view mask with URP's stencils - opposite result of what I want

Discussion in '2D' started by NikkiSIF, Jun 11, 2020.

  1. NikkiSIF

    NikkiSIF

    Joined:
    May 15, 2020
    Posts:
    14
    Hi all,
    i'm new in Unity's community, and I've been trying for 1 month to dive into 2d game making.

    I'm messing with the field of view of my player character which works out pretty well (mesh with obstacle and enemy detection).
    What i'm trying to do at the moment is using the Universal Render Pipeline to make the enemies appear only when the player's field of view is over them. I put layer masks on my field of view mesh and enemies and set this up in a CustomForwardRendered as shown here:

    upload_2020-6-12_0-21-0.png


    What happens here is that my enemies are always appearring, except when my field of view mesh is on them... so the total opposite of what I want. I guess my mistake will appear clearly to you, so i'm asking help here because i can't see the problem.

    Thanks !
    ProstiThony
     
  2. NikkiSIF

    NikkiSIF

    Joined:
    May 15, 2020
    Posts:
    14
    well, after searching a lot on all the topics and tutos i could find, i tried to replace the shader in the mask renderer (under the Forward Renderer) to put a Universal Render Pipeline > 2D > lit instead of my custom handwritten shader and it worked... just that... i don't really understand but, ok !