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 Catie 2 · Nov 05, 2010 at 09:24 AM · mouselookdialogue

Disable MouseLook for dialogues

I've got the Kimmons dialogue generator and when the dialogue pops up its really hard to make a choice without moving the camera view around a lot, which sometimes causes the dialogue to end. How can I make it so that mouseLook is disabled when the dialogue is triggered, and enabled when the dialogue is ended? Thanks!

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Devin · Dec 08, 2010 at 10:13 PM

Make a static variable:

Static var Dialog : Boolean = false;

Then put this inside your update function:

if(Dialog){            
      GameObject.Find("First Person Controller").GetComponent("MouseLook").enabled = false;            
      GameObject.Find("Main Camera").GetComponent("MouseLook").enabled = false;      
}

Keep in mind that this will only disable the MouseLook. To re-enable it use the same idea in reverse with a different If statement. I.E.

if(!Dialog){
      GameObject.Find("First Person Controller").GetComponent("MouseLook").enabled = true; 
      GameObject.Find("Main Camera").GetComponent("MouseLook").enabled = true;      
}

Then all you have to do if you want to initiate a dialog, just put

"Whatever object you put the above scipt onto".Dialog = 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 DuckieMonster · Apr 26, 2011 at 03:20 PM 0
Share

where does this code go? Into the existing mouselook.cs yes but the static variable goes where?

i'm sorry i'm noob i just love unity and i'm workin on a project atm so any help would be greatly appreciated.

avatar image
0

Answer by _Petroz · Nov 05, 2010 at 11:11 AM

Put an 'if' statement around the mouse look code which checks if the dialog is being displayed.

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 Catie 2 · Nov 05, 2010 at 11:42 PM 1
Share

if (DialogueInstance.enabled == true) {$$anonymous$$ouseLook.enabled = false;}

Like this? And you're saying I add it to the pre-existing $$anonymous$$ouseLook.js?

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

No one has followed this question yet.

Related Questions

Head Look for Mecanim 1 Answer

Understanding The Mouselook C# Script 1 Answer

Unity 5 Upgrade: The name 'MouseLook' does not denote a valid type ('not found'). 0 Answers

Mouse Look Help 2 Answers

Vertical axis not working properly 0 Answers


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