Page 1 of 1
Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 6:19 am
by lostmushroom
I have a couple of problems with using a keyboard or controller. Using X or Space to choose dialogue options works perfectly in one scene, but in others, it doesn't seem to work and I have to switch to using the mouse to click on options. Is there something I might have missed in setting this up?
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 9:12 am
by Tony Li
Inspect the Dialogue Manager's Input Device Manager component. Tick Always Auto Focus.
If the Input Device Manager detects that the player has moved or clicked the mouse, it switches the Mouse mode, in which it doesn't auto-focus UI elements ("select" in Unity UI parlance) unless Always Auto Focus is ticked.
If you want to prevent the player from being able to switch to Mouse mode, untick Detect Mouse Control. If you also want to prevent the Input Device Manager from hiding and locking the mouse cursor, untick Control Cursor State.
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 11:37 am
by lostmushroom
Thanks - input works correctly now
I have another small issue, not sure if it's related but it might be an input thing. I have the following sequence in a Dialogue System Trigger on my player character, to stop it from animating during a conversation:
AnimatorFloat(Speed,0)@0.1;
AnimatorFloat(xSpeed,0)@0.1;
AnimatorFloat(ySpeed,0)@0.1;
AnimatorBool(Walking,false)@0.1;
AnimatorBool(Running,false)@0.1;
AnimatorPlay(Idle)@0.1
This works correctly with most conversations, but there are a couple that seem to ignore it, meaning that character loops its jump animation during conversation. They are all using the same conversation zone prefab so I'm not sure what's up with it.
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 1:56 pm
by Tony Li
Is it possible that the player isn't assigned to those conversations, so it's not receiving the message to idle?
More info:
Character GameObject Assignments
You can temporarily set the Dialogue Manager's Debug Level to Info and look for the "Starting conversation" line in the Console. Make sure it reports the correct GameObject for the player.
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 2:19 pm
by lostmushroom
It looks like the player is assigned as the Conversation Actor when it begins the conversation. I also get a warning:
Animator.GotoState: State could not be found
Unity.Engine.Animator: Play (String, Int32)
However, this shows up on all conversations including the ones that work, so I guess it's not that.
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 3:12 pm
by Tony Li
Does the problem consistently happen with the same conversations?
What animator state do you think "Animator.GotoState: State could not be found" refers to? I doubt it's the player, since Idle works in other conversations. Maybe it's a state on an NPC? If you click on the message in the Console window, does the state trace reveal any more detail?
(Feel free to send me a copy of your project with reproduction steps if you're stuck or have other things you need to get to before the end of the jam.)
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 3:32 pm
by lostmushroom
It doesn't seem to happen consistently. I can't figure out the exact steps for reproducing the issue, otherwise I'd send a copy. The only thing I noticed is that it only seems to happen after you've changed scene at least once.
I'll keep trying to figure it out
Re: Input doesn't work correctly across scenes
Posted: Sun Sep 08, 2019 8:08 pm
by Tony Li
It sounds like maybe there's an assignment between a GameObject that's marked Dont Destroy On Load (such as the Dialogue Manager) and a GameObject that's not marked. When you change scenes, the assignment will be lost.