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 Skumtron · Jun 28, 2014 at 05:42 PM · inputngui

Disable game logic related input when touching NGUI objects

I'm implementing NGUI for my game, but ran to a problem. I have two cameras in my game, Main Camera is used to render the whole game world and another, GUI Camera, is to render NGUI. The game's movement is Point and Click so whenever player clicks somewhere, the Main Camera casts ray and game logic moves player to the collision point.

The problem: Whenever I click on any of the NGUI elements, the Main Camera also does it's logic of shooting the ray and getting new destination for the player.

What I'm after is this: Whenever player clicks on any of the GUI elements, the Main Camera understands it and doesn't shoot the ray to get new destination. Also, whenever any NGUI text field is being typed into, any other game world movement info doesn't get used. What is the usual way of handling it?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Denvery · Jun 28, 2014 at 08:59 PM

Hello!

Please assign the different layers for NGUI objects and game objects (about layers http://docs.unity3d.com/Manual/Layers.html).

For example, GUILayer for NGUI objects and Default layer for other objects. Then, in the Main camera use Culling mask = Default, and for GUI camera use Culling mask = GUILayer (about Culling mask read here:http://docs.unity3d.com/Manual/class-Camera.html).

Also you need to tune UICamera component(attached to the NGUI's camera) in the inspector: Event mask = GUILayer (read about event masks here: http://www.tasharen.com/?page_id=148).

Hope it will help a bit:-)

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 Rainking · Feb 02, 2015 at 08:25 PM 0
Share

Thank you! I would like to upvote your answer but I do not have enough reputition :/

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How to Attack using Animation and Input 0 Answers

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers

Why moveDirection.z doesn't work? 2 Answers

NGUI autocorrect 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