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 durnurd · Dec 09, 2014 at 01:21 PM · camerarenderingculling

Why is my sprite not rendering when it is clearly on screen?

I have a sprite onscreen, but it is not rendering. Here's some relevant data:

 sprite.renderer.enabled == true //Good. The renderer is not turned off.
 sprite.gameObject.active == true //Good. The renderer's game object is not turned off.
 Camera.main.active == true //Good, and obvious since it's rendering other stuff
 GeometryUtility.TestPlanesAABB(
     GeometryUtility.CalculateFrustumPlanes(Camera.main),
     sprite.renderer.bounds) == true //Good. The sprite is within the frustum of the camera.
 Camera.main.cullingMask & sprite.gameObject.layer == 0 //Good. The sprite is not on a layer that is culled by the camera.
 sprite.renderer.isVisible == false //VERY BAD AND WRONG. Why would it not be visible?

As far as I can tell, the only things that would affect isVisible are the renderer's bounds, the camera's frustum, the sprite's layer and the camera's culling mask. As seen, all of those values indicate that it should be visible. What else might cause isVisible to be false?

Note that this only happens sometimes. Other times it is perfectly visible. It appears to be related to what else is on the screen when it is instantiated. There are two scenes. When on scene A and it's instantiated, it shows up and continues to display when transitioning to scene B (because of DontDestroyOnLoad). When on scene B, it's invisible, even after transitioning to scene A.

For more information, I've also collected some other data that I don't believe is relevant, but I've included here anyway:

 sprite.renderer.material.color == (1,1,1,1) //Good
 ((SpriteRenderer)sprite.renderer).color == (1,1,1,1) //Good
 sprite.transform.scale == (1,1,1) //Good
 Camera.main.orthographic == true //Good

Edit

I've discovered that one way to cause it to not disappear as often is to disable reflection. Obviously this is not a tenable solution. I'm using a modified version of the Unity-provided water reflection script/shader. It seems like a bug in Unity at this point. I'm not currently running the latest version of Unity (I'm on 4.5.5f1), but I didn't see anything in the release notes of 4.5.5f2+ to indicate it's fixed, and I can't easily upgrade.

Edit 2

This does not happen in the editor. It only happens on a device (iOS).

Comment
Add comment · Show 3
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 taxvi · Dec 09, 2014 at 01:54 PM 0
Share

also try peaking into build settings and tweaking the rendering path between the values, take a look at the Unity Rendering Path manual as well :/ hope it helps

avatar image f4bo · Dec 09, 2014 at 02:02 PM 0
Share

I'm just curious about: what is the reason why you did not update Unity yet to the last 4.6?

avatar image durnurd · Dec 09, 2014 at 05:06 PM 1
Share

$$anonymous$$any reasons we haven't updated yet, including being very close to shipping and we don't want to introduce any new bugs.

1 Reply

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

Answer by MrSoad · Dec 08, 2014 at 09:32 PM

This could be a Z(Depth) drawing issue. It may be that some of your objects shaders are set to draw over the sprite shader. Try a different Shader on the Water as a test to see if this removes the issue. If so your modified shader may need editing.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

3D Objects are not being in their regular shape at distance 2 Answers

Frustum culling doubt 2 Answers

Image effects do not work when rendering with multiple cameras 0 Answers

How to render objects outside the camera's view? 1 Answer

occlusion culling conflict with shader,Occlusion culling conflict with shader 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