#Need help!
1 messages · Page 1 of 1 (latest)
How do you know there's no input? Have you logged the input yet?
I still am trying to figure out which code is used to actually get the object, Then find its values and show them
Get what object
Well i have the player that moves. But i need the moveDirections values to see why my player moves without any key inputs
what's that got to do with getting an object
scrap the object part
lmao
are you logging moveDirections?
trying to
So, log that
where are you getting stuck
logging is about the simplest thing in unity
Whole thing lol. I dont know how to get the value
do you have moveDirections in a script on your player?
are you setting it somewhere?
Yup
You have the value. You're already using it
I have it in script but i dont know how to make the debug log find the values of moveDirection
Just log it after you get it
You log moveDirection
That's it
That's the line
So is it debug log with literally just moveDirection in it?
You just put the variable in the parenthesis
oh.
That's why I said to log moveDirection like an hour ago
It gives an error: Cannot use local variable moveDirection before its declared
Oh sorry. i thought i needed more to it.
Got the values i think
so it moves 0.71 Y and -0.71 X?
without the inputs of a key pressed
What do we do from here?
vector3's are X, Y, Z
So you are getting inputs
The values change on direction
It's moving because you've got move input
I know but how do i make it move only when keys are pressed?
I also have a WalkSpeed variable thats always at 5
Find out whatever device is giving you inputs and probably disconnect it
So thats probably the real reason
what is your code doing
Well i can move other directions
Like forwards
and left
but s and d are kinda not working
How should i check
Ill show the movement
code
Or ill give you the full code
up to you
if horizontalMovement or verticalMovement aren't 0 (you can log them too) then it sounds like you're getting input somehow
K ill log those
Have you done !learn yet? If not, you really need to stop everything and do the essentials pathway AND the junior programmer pathway before continuing. It will save you so much time
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
So vertical movement is forever at -1 and when W is clicked it changes it to 1 which then moves forward
So instead of forever -1 i need 0
sounds like your input system is the problem not your code
Do i fix it in Input Manager?
yup
Do you see the problem?
Update!
Player does not move off spawn
but when key is clicked his vertical movement forever moves forward
Is that code problem or input still?
He forever moves in every direction actually
last key clicked the player doesnt stop going that direction until it is cancled out
I FIXED IT!
TY SO MUCH GUYS!