Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by LonerWC · Jul 03, 2013 at 07:18 AM · screenhowlockto

how to lock screen?

Hi guys, currently i have a NPC, and when you pressed the button 'e', it will pop out a question box and you can click to select the correct answer, but when you move your mouse, your camera will move too right? and my previous partner made a script which only contains this (see below) and it only stops the camera from moving left and right but not up and down.

when the button 'e' is pressed, the "LOCKDOWNScr = true" is called but it only locks left and right, but not up and down. i don't get it, the script is empty but it works only for left and right?

need some help please ~ thanks !

 using UnityEngine;
 using System.Collections;
 
 public class LockingDown : MonoBehaviour 
 {
     public bool LOCKDOWNScr = false;
     
     // Use this for initialization
     void Start () 
     {
     }
     
     // Update is called once per frame
     void Update () 
     {
     
     }
 }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KiraSensei · Jul 03, 2013 at 07:29 AM 0
Share

You must have another script that instantiates LockingDown. Try to find where you do : "new LockingDown()"

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by fafase · Jul 03, 2013 at 07:34 AM

I would guess you are using the Character Controller and the mouse control that goes with it. If not, the same process will apply anyway.

Simply deactivate the mouse control script while the gui is on and reactivate it when you have made your choice. Using the CC, you have to get two MouseLook

 bool guiOn = false;
 MouseLook scriptPlayer;
 MouseLook scriptCam;
 
 void Start(){
     // If the GUI script is not on the character then you need first to find the object
     scriptPlayer = GetComponent<MouseLook>();
     scriptCam = scriptCam.GetComponent<MouseLook>();
 }
 
 void OnGui(){
     if(guiOn){
         scriptPlayer.enabled = false;
         scriptCam.enabled = false;
     }
     if(choice is made){
         scriptPlayer.enabled = true;
         scriptCam.enabled = true;
     }
 }
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LonerWC · Jul 03, 2013 at 09:59 AM 0
Share

alright thanks i'll try this out.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Keep AI @ right height, walk down hills and up and stuff. 3 Answers

How to make a side scroller dirtbike move across hills. 0 Answers

One Last GUI Question 1 Answer

Wait Until Sound is Finished 2 Answers

How to kill enemies by jumping on their heads? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges