- Home /
Unity 5 Horizontal Axis Event Trigger Problem
Hi...I am using Unity 5. It has Cross Platform Input in standard assets. As shown in one of the example scene, I have used ButtonHandler Script for Left and Right Button in game(left right movement). Screenshot of this is attached![alt text][1] [1]: /storage/temp/51039-unityscrren.png
So as you can see for left button pointerdown is buttonhandler.setaxisNegative and pointerup is buttonhandler.setaxisNeutral. For Right its buttonhandler.setaxisPositive. So basically this all works pretty fine. But in game if button is held pressed while death of my player. and when game restarts(scene reloaded after clicking retry button) whichever button was held pressed while dying that button is still in function.
In simple words if my player dies while left movement button was pressed, when the scene reloads my player will keep moving to left as if the button is held pressed. it becomes negative only after i press right button once. please help me...I am totally stuck at this..
Answer by Suraj. · Jul 27, 2015 at 05:42 AM
Never Mind. I found the solution by myself. I imported StandardAssets (`using UnityStandardAssets.CrossPlatformInput;`)data in my script which i used to change scenes. in my changescence function I added this CrossPlatformInputManager.SetAxisZero("Horizontal");
Your answer
Follow this Question
Related Questions
UI button in Panel not clickable 2 Answers
Please resolve my issue with below scripts- Player didn't move left and right 2 Answers
UI Text In Seconds 2 Answers
Issue with spawning buttons and assigning listeners 1 Answer
Unity 5: How to display bird eye view layout of a 3D scene with UI component overlay on screen? 1 Answer