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 $$anonymous$$ · May 03, 2013 at 05:07 PM · camerarenderer

Camera can see an Object

Hi, i've got a quetion. I have a boolean in my script, and i want my boolean to be true, if the Camera looks in the direction of an object. I already tried

 if(gameObject.renderer.isVisible)
 {
    boolean = true;
 }
 else
 {
    boolean = false;
 }

but, everytime i do that, the boolean will return as true (in every situation). Is there an other way, or am I doing something wrong?

Comment
Add comment · Show 4
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 $$anonymous$$ · May 03, 2013 at 05:19 PM 0
Share

but the boolean is returning true when im not even looking in the direction of it. I only testet it in the game-mode.

avatar image ExTheSea · May 03, 2013 at 05:23 PM 0
Share

What brian means is that if you're seeing the gameoject in the scene view renderer.isvisible will return true. Try turning the scene view to look into nothingness or compile a build.

avatar image $$anonymous$$ · May 03, 2013 at 05:24 PM 0
Share

haha. im sorry, i didn't noticed i had a camera on my gameObject. $$anonymous$$y fault......

avatar image ExTheSea · May 03, 2013 at 05:29 PM 0
Share

Ok now there are two options. 1. brian converts his comment to a question and you can accept it. 2. You close the question but please thumbs up brian's comment :)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by roojerry · May 03, 2013 at 05:15 PM

from Renderer.isVisible

Also, when running in the editor, the scene view cameras will also cause this value to be true.

Do check that link as there can be other quirks to using isVisible. If you need a more precise solution because of those issues, feel free to ask again

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

13 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

Related Questions

Graphics raycasting if renderer in game object is seen and not occluded 1 Answer

Changing two different objects renderer colour 1 Answer

Renderer.isVisible always returning false 2 Answers

Duplicate everything in a set space in all directions? 2 Answers

How can i active again a render texture after set it to null ? 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