- Home /
Camera only displaying one object even though culling mask is set to everything
Well it is basically as the title says. I am working on setting up a camera for each player. Currently, however I am only working with one player. Essentially the problem is when I instantiate the player and the player camera, everything seems to work, I switch to display 2 (which is what the camera is set on) and it only displays that character. I've tried moving the camera around in the hierarchy, (in the canvas, out of the canvas, as a child of the player object, etc.) but that doesn't seem to help. The camera is set to a position where it should see everything else. The camera is at -10 z, everything else is -1 z or above, and the objects appear to fit within the lines the camera sees. The other objects that should be displayed are buttons. This is a 2D game in case you were wondering.
On a slightly related note, I often run into bugs that seem to have no correlation with the code or anything else. For example, in one game I made the level generation would only go partway and then stop. There did not seem to be any reason. Eventually, I cut out the code, ran the game, ended the game, pasted back in the code and it worked just as it should. Why is this? Is it my computer that is having problems (it is pretty old...) or what?
I'm pretty sure your Culling $$anonymous$$ask has nothing to do with the bug. Don't quote me on that though.
I would probably agree, but if I were to do this on purpose I would use the culling mask, so I figured it might have something to do with it.
What are the buttons? UI buttons (canvas), GUI buttons (OnGUI) or the legacy UI system (GUIText, GUITexture)?
They are UI buttons (but lack the text component since I don't need it).
Answer by Mergster · Jul 07, 2017 at 04:15 PM
If this is a 2d game, your Camera's z position MUST be set to -10.
It is. I have changed it to see if it would help, but by default (in the preset) the z value is -10.
Then your other camera settings must be wrong. Is the Near clipping planes set to 0.3? And could you provide a screenshot of your camera's inspector.
The near clipping pane is set to .3 and the far to 1000. Here's the screenshot. Note that this is the instantiation of the camera and not the prefab, although it hasn't been altered from the prefab.
Your answer
Follow this Question
Related Questions
Camera culling problem 3D 0 Answers
Camera Change Bug 0 Answers
Raycasting with multiple cameras and displays 1 Answer