Course Unity Visual Script : Input Axis doesn't work like the video

Hello,
I’m following the video about Visual Script and the video about getting the Input Axis doesn’t work, for an unknown reason, when i push play button, the player go always on the top left… but i can control with the arrow keys or ASWD keys, but if i touch nothing, the player always go to top left…

you can see my Visual Script on this post.

maybe i’ve missed something? i’ve started the video from the beginning, i have done everything.

thanks for your help.

What I can see of your script graph looks correct, though it’s cut off. However, the movement you describe sounds like what was done in an earlier lecture for the EnemyController script graph, is it possible that the player isn’t using the correct script graph? Check that you have the PlayerController script graph in the player’s Script Machine, and that there isn’t a second Script Machine added to the player with a different Script Graph.

Hello, thanks for your reply, i’ve checked if Player object have playercontroller and it’s ok. Is it possible i’ve missed something in the Project Settings?

Thanks again

If you’ve changed something in the Input Manager of Project Settings it could cause unexpected behaviour, or it’s possible that you’re getting input from something other than the arrow and ASWD keys. The Horizontal and Vertical will also respond to a gamepad/joystick/certain mouses.

hmm really strange, i have no gamepad… i’ve see something strange, with the Vector3 node, the defaut value start at X=-1 and Y=1…

does i need to do something on that vector3d? or is it the Vertical and Horizontal value that have something to do with that?

Thanks.

If you mean the distance variable, that shouldn’t be connected any longer, so its values won’t matter. If it is connected somewhere, that could be the issue! The only Graph Variable currently used should be movementSpeed which I can see in your picture. Just for clarity, the full picture should look like this:

The Graph Variable we care about is movementSpeed, distance still exists but isn’t being used, changing those numbers shouldn’t affect anything:

Graph Variables

And the Input Manager values for Horizontal and Vertical should look like this:

If all of these things look the same in your project, the problem is likely caused elsewhere. You could check something like the Rigidbody 2D and make sure Gravity Scale is set to 0

Satinel has mentioned all of the likely culprits here, nicely done!

Thanks for your reply, i have all the same as you posted. but the problem still there.

Here is an image about the X=-1 and Y=1 when i dont touch any keys


like you can see the Vector3 looks by default the -1 and 1 values.

Everything is like you posted, except the result! :disappointed_relieved:

After a look, it looks like the problem isnt the vector3 but looks like here

image
like you can see, the getPosition at the start is -3.02 and Y=-4.02
and sometime the multiply give X=-0.02 and Y=0.02 …

this is when i touch nothing!

Those pictures show that something is sending input information. The result of the Vector 3 Create should be (0.00, 0.00, 0.00) when there’s no input, the results of the Multiply nodes will also be 0 since any value they get from Get Delta Time and movementSpeed will be multiplying by 0.

Some device on your system is sending input information through the Get Axis nodes. In the Input Manager there is actually a second set of Horizontal and Vertical which are used for controllers by default, but if you don’t have a controller connected that shouldn’t be causing the issue.

Someone in an unrelated Ask thread had a special mouse which was sending input information, so it could be something like that, but without knowing what’s connected to your system there’s no way to guess. If you can’t find what that is, a drastic measure would be to start changing things in the Input Manager, like renaming the second Horizontal and Vertical set to make sure they aren’t influencing the Script Graph, but that’s not an ideal solution. If it’s possible, test your game on a different system and see if the same problem exists there.

I’ve tested on another computer as you say, and same thing. I’ve tested with another input like Mouse X and Mouse Y, it’s working good! i really not understand why! i have only a mouse on my computer, and i’ve tested to get the mouse on my and to be sure it’s not moving, but not changed the result! :\

I’m completely stumped, myself, sorry! Maybe someone else will have an idea.

1 Like

No problem, thank you for your help.
I think i’ve found a soluce, i’ve deleted the Horizontal and Vertical for gamepad … and now everything are ok!
I don’t know why i have no gamepad on my computer. maybe is a conflit with XBOX soft, don’t know…

1 Like

I’m glad you found a solution!

1 Like

Eventually you’ll want to learn about the newer Input System, which should help you avoid these issues with input.

It’s definitely strange that the gamepad input would give that result when you have no gamepad connected. But I am glad that a solution could be found!

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms