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 Mushu · Oct 02, 2013 at 04:16 PM · cameraclickmovingngui

NGUI doesn't work when camera is moving, but is fine when camera is stationary

Hi there

I'm developing the control system for a platformer and am using NGUI. Everything works correctly until I enable my camera to follow the character. That is to say, when the camera is static all the NGUI widgets etc all react as they should but when the camera is moving, buttons don't pick up every click and the UIDragObject I'm using as a joystick snaps to the side of the clipping bounds of it's panel.

Again, this all works fine if the camera doesn't move.

Each NGUI object has a UIAnchor set to use the camera and the camera has a UICamera script on it.

Do you have any ideas what the problem could be and/or how to solve 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
2
Best Answer

Answer by vexe · Oct 02, 2013 at 11:23 PM

You're using UI camera as your normal, platform camera, you're moving it, making it follow the player, etc.

Now:

-If your panel isn't a child of your UICamera, then when you move it, make it follow the player, etc your panel and widgets will go out of the camera's range, so it won't detect them.

-else if it is a child to your UICamera, then moving the camera around should also move the whole UI underneath the camera (the panel and the widgets) - You didn't mention that, so I guess that's not the case here.

Anyway, make sure you have a standard UI hierarchy, like:

 Root
   Camera
     Anchor
       Panel

And then, use a separate normal (doesn't have a UICamera script) camera for your platformer purposes, move that around, follow the player, etc and leave your UICamera intact.

PS: There's a 'Debug' checkbox in UICamera, tick it, it gives you feedback on what collider the camera's ray is hitting, very helpful.

Let me know how it goes.

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 Mushu · Oct 03, 2013 at 02:27 PM 0
Share

Thanks. Yeah the issue was from not having my UI camera as a separate camera from the player camera.

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

15 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

Related Questions

Ngui Camera and Image effects 0 Answers

Adjust Viewport Locations When Going to Full Screen -1 Answers

Getting camera to not see under the ground 3 Answers

WorldToScreenPoint, isn't getting it right? 1 Answer

How do I make my flashlight follow the camera when moving? 2 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