Interacting with Response using keyboard/controller

Announcements, support questions, and discussion for the Dialogue System.
alfonso
Posts: 104
Joined: Mon Jul 13, 2015 6:31 am

Re: Interacting with Response using keyboard/controller

Post by alfonso »

You can changed this behaviour in the EventSystem gameObject of the scene, there in the Standalone Input Module, you can change the axis(Horizontal, Vertical) Cancel and submit buttons. And in the input setting (edit->project settings -> input) you can change how unity recognize the axis and the cancel submit buttons.

i think unity assign automatically the stick to the same of this axis

:)
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Interacting with Response using keyboard/controller

Post by nishant »

Just an update .. I managed to fix it . About the auto focus not working , it was my bad :( . Just that the highlight color was same as normal color ,so although it was getting focus , it wasn't visible. About the navigation not working , that was because my game uses a custom input module which overrides the default one . So for that I made another script that would manually switch the buttons based on the key . I took reference of the code that Alfonso sent before.

Code: Select all

if(UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject == this.gameObject)
		{
			if (Input.GetKeyDown(keySelect) || (!string.IsNullOrEmpty(buttonNameSelect) && Input.GetButtonDown(buttonNameSelect))) {
				var pointer = new PointerEventData(EventSystem.current);
				ExecuteEvents.Execute(button.gameObject, pointer, ExecuteEvents.submitHandler);
			}
		
			//HACK
			if (Input.GetKeyDown(keyUp) || (!string.IsNullOrEmpty(buttonNameUp) && Input.GetButtonDown(buttonNameUp))) {
				StartCoroutine(SetSelectedGameObject(nav.selectOnUp.gameObject));
			}
			if (Input.GetKeyDown(keyDown) || (!string.IsNullOrEmpty(buttonNameDown) && Input.GetButtonDown(buttonNameDown))) {
				StartCoroutine(SetSelectedGameObject(nav.selectOnDown.gameObject));
			}
			
		}
Yes I know , its hacky but will have to do for now till I modify the input module .
Any way thanks guys for your help . :)
Post Reply