Mouse Lock Function?

Hi, all.

I’m having trouble locating the mouse lock function for the Webplayer. (I have version 1.6.1). Is it a script? Is it automatic? Is it a component? I searched in the project settings, too, but came up with nothing. I built a Webplayer version of my game to see if it was automatic, but still came up with nothing. I’m quickly sinking into a morass of despair, and finding the mouse lock function is the only thing that will pull me out of it.

Another question: Is the mouse lock function only for the Webplayer, or can it be used in a standalone?

Thanks for your help! :cry:

http://unity3d.com/Documentation/ScriptReference/Screen-lockCursor.html

HTH,

– Clint

A quick search through the documentation gave me Screen.lockCursor

It works both in standalone and web player.

Ah, yes, thank you! For some reason my searches through the documentation kept missing that. :slight_smile:

Cool! I added go.GetComponent(“MouseLook”).enabled = false to disable the mouselook while the cursor is present so that the player can click objects in the scene without getting dizzy. I always wondered how to take care of that problem and finally figured it out. I’m new to scripting, so every little advance I make gets me pretty excited. :slight_smile:

Now I feel confident enough to build my own self-aware computer from scratch.

Oh great, so you’re the reason we end up with Skynet and terminators and all that jazz. I hope you’re happy. :wink: Now someone’s going to have to be sent back in time to make you buy Torque instead of Unity…

–Eric

Sorry, Eric, it’s already too late–I bought Torque before I bought Unity. Now I have to go back in time to un-buy Torque, which has been sitting uselessly on my computer since I got Unity.:sweat_smile:

My threat to build a self-aware computer is only me blowing hot air, fortunately. I don’t want to be responsible for the end of the world as we know it.
I do, however, have plans to build a computer called HAL.