简体   繁体   中英

Game Object Appears in Scene View but not in Game View

Seems like I am missing something here, using latest version of unity and I am instantiating a gameobject on click.. It appears fine in scene View but not in the game view?

I have googled it and tried all those responses.

I checked the layers at the top right of the screen, They are all showing, Also the z value is lower than the cameras' But honestly i have tried having them at nearly all z positions.

The game object i am spawning is a sprite with a rigid body, but that shouldn't matter right? It shows up in scene view and game view should just show me what the scene does?

Any ideas?

This is a pretty old question but I just had the same issue. I solved it by playing around with the camera clipping planes.

To test if this is the case, hit play and when the object is supposed to be in view, hit pause.

Select the camera from the hierarchy and try altering the clipping planes - "Near" and "Far" properties from the inspector.

If this works then don't forget to make the same changes again after the game has stopped running - They reset to the way they were before you hit play.

I think this is to do with the distance from the camera that objects have to be, in order to be rendered. Its probably useful with fog etc. but I'm kinda new to Unity so could be wrong.

I tried posting a screenshot but apparently you're not allowed to help properly if you're new on here :s. probably to prevent spam etc.

Anyway, hope this helps someone out there :)

统一截图

It can happen for may problems

1. Culling mask problem:

just check it, it is set to everything or not

剔除面具

2. Far Near problem:

Solve it by changing their values. I can't say about any specific values cause it varies from problem to problem

远近问题

3.Layer Problem:

this problem specially happen when you a create a new scene on unity but it can happen for many reasons

To solve this

  • Click on layers
  • Set everything visible

在此处输入图片说明 在此处输入图片说明

在 MainCamera 或 Camera 的 Inspector 上,您会找到称为“深度”的东西,只需将其设置为与您的视野相同的值即可:)

By default in a 2D scene the camera is pointing to positive Z and it is located at (0 1 -10). This means that the Z position of the sprite needs to be higher than cameras Z position, not lower.

Also check that Sprite Renderer of the sprite is enabled in the "Inspector" view.

If those doesn't help I would suggest starting to remove other GameObjects at run time to see if the sprite is behind something. Just click on a GameObject at "Hierarchy" view and hit delete key.

Hopefully some of these help you to find the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM