Page 1 of 1

Can't interact unless on default layer

Posted: Fri Mar 15, 2024 9:23 pm
by Kadum1013
Hello all, I just started using Dialogue System For Unity today. Watch all the tutorials and everything works but when I tired adding it to my already made NPC, hooked everything up. The interact text isnt showing up, I figured out if the NPC layer is set to default then it works. On the player in the Selector script, I tired setting it to just to the Character layer. When the NPC is set to default and the Layer Mask on the selector is set to Character only, when i pass the mouse over the NPC it quickly shows the interact text and goes away. it happens really fast.

I am not sure what I am doing wrong, I would like to use the Character Layer mask so i can just plug the Dialogue system.

Thank you for taking the time to read this, any help would be very welcoming!
I can get pictures and such of the setup if need be.

Thank you.

Re: Can't interact unless on default layer

Posted: Fri Mar 15, 2024 10:45 pm
by Tony Li
Hi,

Thanks for using the Dialogue System!

Please see: How To: Fix Selector and Proximity Selector Issues

It should work fine if your NPC is on the Character layer and your Selector's Layer Mask includes the Character layer.

If it's not working, make sure another collider on a different layer isn't blocking the Selector's raycast. Tick the Selector's Debug checkbox. If you're running raycasts in 3D and you tick the Selector's Debug checkbox, it will show what 3D objects it's detected:

Image

In the Scene view (on the left), the yellow line is the raycast from the camera. It detected the NPC, Private Hart, so it drew a green sphere at the detection point. If it were blocked by a non-Usable GameObject, it would show a red sphere at the hit point.

Re: Can't interact unless on default layer

Posted: Sat Mar 16, 2024 8:58 am
by Kadum1013
Ahh I see, the debug helped. The problem I seem to be having is my game is in 3D, in 3rd person view over the Player. The ray it shoot is coming from the camera and hitting the player. Is there a way to change where the ray gets shot from
or will I have to just set it up to use the proximity selector?

Thank you for the quick reply!

Re: Can't interact unless on default layer

Posted: Sat Mar 16, 2024 1:01 pm
by Tony Li
Hi,

Some ideas:
  • Put the player on a layer that's not in the Selector's Layer Mask. (DemoScene1's Player is on the Ignore Raycasts layer, for example.)
  • Make and use a subclass of the Selector class that overrides Run3DRaycast to run the raycast from some other point (e.g., a point a little bit ahead of the player's collider) instead of from the camera.
  • Or use a Proximity Selector.
  • Or your own selection/interaction system. Use of Selector/ProximitySelector is optional.

Re: Can't interact unless on default layer

Posted: Sat Mar 16, 2024 1:59 pm
by Kadum1013
I understand! Thank you for the tips!
Making sure I wasnt missing something that was staring me in the face lol.

Thank you again for the help!

Re: Can't interact unless on default layer

Posted: Sat Mar 16, 2024 7:24 pm
by Tony Li
Glad to help!