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
1
Question by NeMewSys · Aug 21, 2012 at 11:16 PM · cameraobjectvisiblefov

Know if gameObject is being seen

Hi people!

Is there a quick way to check if gameObject is inside a camera's view? I mean, if the user can see it on the screen, if there's no wall blocking it, or if its inside the camera's field of view, etc...?

Thanks!

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 Bunny83 · Aug 22, 2012 at 12:15 AM 0
Share

$$anonymous$$eep in $$anonymous$$d that a GameObject can't be seen, only a Renderer component that might be attached to the GameObject.

2 Replies

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

Answer by reptilebeats · Aug 21, 2012 at 11:25 PM

put this on an object to start this function when it became visable by the camer

 function OnBecameVisible(){
 //do something
 
 }

and use this in a function to do something if it is visable

 if(renderer.isVisible){
 
 //do something
 
 }

these will both work when your editor view is on the object as well so use a debug in them to check it

Comment
Add comment · Show 5 · 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 NeMewSys · Aug 21, 2012 at 11:54 PM 0
Share

Works very well. Thanks! :D

avatar image reptilebeats · Aug 22, 2012 at 12:10 AM 0
Share

no probs it had me stumped when i first used it to play some animation, thought it wasnt working until i realised it worked with the editor window as well.

avatar image NeMewSys · Aug 22, 2012 at 12:15 AM 0
Share

Yes, you spared me some hours of life by warning about that hehe :)

avatar image Kryptos · Aug 22, 2012 at 09:35 AM 0
Share

Fixed your answer: your wrote OnBecameVisable ins$$anonymous$$d of OnBecameVisible.

avatar image reptilebeats · Aug 22, 2012 at 01:55 PM 0
Share

did i woops, thank god for mono develop auto selection

avatar image
0

Answer by ehliel · Oct 17, 2016 at 05:00 AM

OnBecameVisible is always run?

and renderer.isVisible is not even available in the compiler (it is not known)?

i still spend hours in this matters

please reply here and alert me @ e2444@yahoo.com

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

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

11 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

Related Questions

Check if specific camera sees object 0 Answers

Make object visible only for camera "X" 1 Answer

Is object at least partly visible? 1 Answer

Activate object if visible and Deactivate object if invisible 2 Answers

How to set the position of objects on the left and right of the screen 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