Page 1 of 1

Usable/Selector issue

Posted: Sun Jun 05, 2016 9:44 am
by VadsterLobster
Hello support team,

I want to use Usable and Selector for prompts in the game. But I've got the issue with them.

When Player see the Door, "Out of Range" or "In Range" message appears. And my problem is: when player turn away from the door, message continue to stay on the screen.

I have
1)GameObject "Door". It has Mesh, Box Collider, Mesh Renderer and Usable component.

2) Player. It has Selector, Unity UI Selector Display, Persistent Position Data and my own controller

3) Dialogue Manager with no changes.

Sorry for my bad English. Look forward to hear from you soon!

Re: Usable/Selector issue

Posted: Sun Jun 05, 2016 11:13 am
by Tony Li
Hi!

Can you please post a screenshot of your Selector component's Inspector view? By default, the Selector runs a raycast from the camera to the center of the screen. It targets the first Usable that the raycast hits.

It's possible to configure the Selector differently, such as running a raycast to the mouse position or a custom position that you specify.

Depending on your needs, Proximity Selector might also be a better fit.

If possible, please also post a screenshot of the situation you described: the player turned away from the door, with the message still on the screen.

Re: Usable/Selector issue

Posted: Mon Jun 06, 2016 5:34 am
by VadsterLobster
Hello,

Thanks for your reply. I tried to configure the Selector differently. It doesn't help.

Here are screenshots (White Cube is the "Door"):
http://imgur.com/a/otdho

I guess some scripts on the FPS controller are not fully compatible with the Selector and Usable.

Hope you will give me a hint how to fix it.

Re: Usable/Selector issue

Posted: Mon Jun 06, 2016 12:50 pm
by Tony Li
Hi,

Can you please post a screenshot of your Unity UI Selector Display component?

As a test, what happens if you temporarily disable Unity UI Selector Display? In this case, it will use the default GUI. The Unity UI elements will still be visible; just ignore them for the test. If the default GUI appears and disappears correctly, we can narrow the problem down the Unity UI Selector Display. If the default GUI also fails to work correctly, the problem is probably with the Selector configuration.

Try comparing your player's setup to the example scenes in Examples/Unity UI Examples.

Finally, you can tick Debug at the bottom of the Selector component. This will draw gizmos in the Scene view that show where the Selector is raycasting and what it's finding.

Re: Usable/Selector issue

Posted: Thu Jun 09, 2016 10:54 am
by VadsterLobster
Sorry, I haven't notice the warnings:

1)Parameter 'Hide' does not exist.

UnityEngine.Animator:SetTrigger(String)
PixelCrushers.DialogueSystem.UnityUISelectorDisplay:HideControls() (at Assets/Dialogue System/Scripts/Supplemental/UI/Selector/UnityUISelectorDisplay.cs:181)
PixelCrushers.DialogueSystem.UnityUISelectorDisplay:Update() (at Assets/Dialogue System/Scripts/Supplemental/UI/Selector/UnityUISelectorDisplay.cs:203)

2)Animator has not been initialized.

UnityEngine.Animator:SetTrigger(String)
PixelCrushers.DialogueSystem.UnityUISelectorDisplay:HideControls() (at Assets/Dialogue System/Scripts/Supplemental/UI/Selector/UnityUISelectorDisplay.cs:181)
PixelCrushers.DialogueSystem.UnityUISelectorDisplay:DisconnectDelegates() (at Assets/Dialogue System/Scripts/Supplemental/UI/Selector/UnityUISelectorDisplay.cs:138)
PixelCrushers.DialogueSystem.UnityUISelectorDisplay:OnDisable() (at Assets/Dialogue System/Scripts/Supplemental/UI/Selector/UnityUISelectorDisplay.cs:104)


I don't know maybe I should place animator somewhere. But it works fine when I comment out if-else statement in the function of UnityUISelectorDisplay.

private void HideControls() {
//if (CanTriggerAnimations() && !string.IsNullOrEmpty(animationTransitions.hideTrigger)) {
// animator.SetTrigger(animationTransitions.hideTrigger);
//} else {
DeactivateControls();
//}
}

Re: Usable/Selector issue

Posted: Thu Jun 09, 2016 12:04 pm
by Tony Li
Here are a couple ways to fix it:

1. If you want to use show/hide animations, inspect the selector UI's main graphic and assign Prefabs/Unity UI Prefabs/Amation/Canvas Group Animator/Canvas Group Animator Controller to the Animator component's Controller field. Make sure your main graphic has a Canvas Group component.

2. Or, if you don't want to use show/hide animations, remove the Animator component.