How to use proximity selector and selector at the same time (with camera-perspective Mode)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
shyboy0113
Posts: 4
Joined: Sat Aug 26, 2023 4:45 am

How to use proximity selector and selector at the same time (with camera-perspective Mode)

Post by shyboy0113 »

Hello, I have a question about Selector, so I'm writing this.

I am now checking the difference between selector and proximity selector.

First of all, my current understanding is that the probity selector must have a collider, which should work as a trigger.

In addition, I understood that selector is useful when specifying contacts with a mouse pointer.

The questions that I have during the development are as follows.

1. Can't I use selector and proximity selector at the same time?
I want to make sure I can take advantage of both situations when I get close to the npc or click with the mouse.

When I put both scripts in the player and checked, it seems that the function of the selector limits some of the function of the proximity selector. For example, if a character's selector UI is activated with a mouse pointer, if you go close and press the space key, the conversation will work, but the selector UI by the proxy selector is not activated.

2. Currently, there seems to be a limitation of setting the camera mode to orthographic in order to utilize selector and proximity in Unity 2D.

I'm using perspective mode to give 2d games a three-dimensional effect. For example, making three-dimensional cars or castles made of paper, which are sold in supermarkets.

The problem is that if you set it to perspective mode, neither the selector nor the probity selector will function. It's possible to get closer and talk, but the logic with the selector UI enabled, starting with mouse recognition, didn't work at all.

How can I solve this problem?
User avatar
Tony Li
Posts: 20744
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to use proximity selector and selector at the same time (with camera-perspective Mode)

Post by Tony Li »

Hi,

The Selector uses raycasts and, if you're using 2D, the camera must be orthographic.
(See How To: Fix Selector and Proximity Selector.) In 3D, the camera can be in perspective mode.

The Proximity Selector uses a trigger collider and will work with any camera mode in 2D or 3D.

Neither the Selector nor the Proximity Selector are required to use the Dialogue System. They're only provided as an optional convenience. It sounds like you might want to use some other technique to interact with Usables instead of the Selector or instead of both. As long as it sends "OnUse" to the Usable GameObject, the Dialogue System will work happily with it. For example, you could add a script like this to the Usable GameObject:

Code: Select all

using UnityEngine;
public class UseOnClick : MonoBehaviour
{
    void OnMouseDown() // Assumes Usable has a collider.
    {
        SendMessage("OnUse", null, SendMessageOptions.DontRequireReceiver);
    }
}
Post Reply