Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.36f1
2022.3.22f1
2023.2.15f1
6000.0.0b12
Issue ID
UUM-66817
Regression
No
CullingGroup.IsVisible returns false when the GameObject is in Game View
Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Assets/scenes/test stage 1 mechanical“ Scene
3. Enter Play Mode
4. Using W, A, S and D keys, navigate the player ship to the center of the Game view
5. Press “1” key on the keyboard
6. In the Game View, hold the left mouse button down until the bar at the bottom of the Game View fills up and then release it
7. Repeat step 6 multiple times
Expected result: Each time after releasing the left mouse button, a “wave 4 bullet(Clone)” GameObject appears in the Scene
Actual result: The GameObject does not always appear
Reproducible with: 2021.3.36f1, 2022.3.22f1, 2023.2.15f1, 6000.0.0b12
Reproducible on: Windows 11
Not reproducible on: No other environment tested
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Search: Inspector section icon is less sharp/more pixelated than other editor icons
- Search description string is always truncated
- [VFX] When Grouped Nodes are converted to Subgraph Operator resulting Graph Node is not included in the Group
- Search window icons are less sharp/more pixelated than other editor icons
- The Inspector can be covered when scaling the horizontal separator bar
Resolution Note:
This behavior is intentional. The CullingGroup.IsVisible() method determines the visibility of a BoundingSphere based on the data from the PREVIOUS frame. Since your BoundingSphere array is static and shared across various Culling game object instances, the visibility result you're observing is not immediately updated. When you update a BoundingSphere's position, its culling result for the current frame isn't yet computed because the camera hasn't commenced culling for this frame. Therefore, you receive the visibility status from the last frame, where the BoundingSphere might have been in a different position and consequently culled.
To address this, consider checking visibility in the OnRenderObject() method instead of LateUpdate(). By the time OnRenderObject() is called, culling is complete, and you have the accurate visibility result for the current frame.
If you prefer to continue using LateUpdate() for the visibility test, ensure you delay the first IsVisible() call and destruction of a newly created object by one frame to avoid immediate deletion. The corrected implementation in OnRenderObject() would look like this:
void OnRenderObject()
{
if (!IsVisible())
Pool.Destroy(gameObject);
}