- Home /
w Key - Character Jumps
I found the solution to this problem. The mesh Collider on the character was causing the movement issue but what about the cursor?
When I press the W key, my character seems to move along the Y axis and not X or Z. Im using a free version of unity, and I have no custom scripts.
I have a Sphere (Character) - Main Cam is a child of Character - Character has: - + Character Controler - + Character Motor - + FPS Input Controller - + Mouse Look Script
All these are standard scripts that came with my unity install.
The other problem I have is that the script is not hiding my cursor:
#pragma strict
function Start () {
Screen.showCursor = false;
Screen.lockCursor = true;
}
function Update () {
}
I have done this in JS and C#. I have also tried to build the project and then test it, still didn't work.
I'm new to unity, so any help or advice is appreciated.
Have you remembered to attach this script to a GameObject in your scene? You should also give some more details in your questions (in general). You say you have tried to build it. Then what platforms/device are you building to?
Answer by sarthakspidey · Sep 05, 2014 at 12:38 PM
You must use the two lines inside the Update() function. Like this:
#pragma strict
function Start () {
}
function Update () {
Screen.showCursor = false;
Screen.lockCursor = true;
}
I hope I helped. :) Cheers, happy developing!
No. There is no requirement of having to set the showCursor and lockCursor on every update. Having it in Start() will work just fine.
^ @GameVortex, I tried that script myself in $$anonymous$$ono, and found out that it doesn't work in the Start(). Don't know why, though...