Jiminion
Jiminion

Reputation: 5164

My Unity project cannot see the new object I have added

I am working with a simulated environment built in Unity. I am trying to add a new object. It can 'sort of' detect it, in that the program is aware of its presence. But it fails to ever determine the object is 'visible' according to its isVisible routine. The routine seems to examine a collider box/region to determine if it is in the visual scope of the camera. But I cannot get this to work. Is there any special thing you have to do with colliders so something can be 'seen'? The also have a field in their object structure called 'visibility points', but I don't know what they are and they don't seem to be used by the isVisible routine.

Also, I am not sure how standard the object structure is for Unity. (Hopefully, some of this seems familiar.) I am hoping someone might have some insight on how objects can be set up to be deemed potentially visible in such an environment. I have tried to replicate the fields and sub-objects of other existing objects, to no avail.

Upvotes: -2

Views: 41

Answers (1)

Mike The Elf
Mike The Elf

Reputation: 88

If it's a 2d game it must have a sprite renderer to be visible or invisible, it can't be an empty gameobject. Also, if you are testing in the engine then even if it's off the screen in the game view but you can still see it in the scene tab then it will still register as visible.

From the documentation

"Note that the object is considered visible when it needs to be rendered in the Scene. For example, it might not actually be visible by any camera but still need to be rendered for shadows. When running in the editor, the Scene view cameras will also cause this value to be true."

Upvotes: 0

Related Questions