- Home /
Instantiated GameObject Not Rendering
So, in my game i instantiate and GameObject like that
GameObject go = Instantiate(Resources.Load("MonsterPrefab/ZumbiToStrangle")) as GameObject;
And it shows up in the Hierarchy and even in the Scene View but it does not show up in the Game View or the Build View It only shows up in the Game View when i see the object at the Scene View that seems to be the only way it renderers
It only shows up in the Game View when i see the object at the Scene View that seems to be the only way it renderers
Answer by DanVioletSagmiller · Jun 12, 2018 at 06:01 PM
It sounds like your camera is looking at different layers. For instance in the inspector, look at the Layer drop down right under the name. What layer is it? Default, or something else.
Then check out your camera's culling mask. Does it say everything, or something else? The camera has to be able to see the layer that the object is on.
Not sure what else would cause this.
However, I do recommend referencing the objects ins$$anonymous$$d of going off of string paths. String paths can get lost in a build, and software that is used to remove unused content, will not find those references.
Can you create a Public GameObject Prefab field, and instantiate from that ins$$anonymous$$d of from a call to Resources? (I'm not sure why this would cause it, but loading it a different way might have some impact.)
Good Idea, but also did not work im not sure how to fix this i know it is a render problem and maybe it is in the camera do you know if there is any config in the camera?
Your answer
Follow this Question
Related Questions
How to mask 3D game object or 2D sprite? 1 Answer
How to not instantiate an object if there is another object there? 1 Answer
Instantiated Prefab doesn't find main camera 2 Answers
Piece of code creates unwanted GameObjects in scene 3 Answers
C# Why do I have to use .AddComponent and not "new (ClassName)"? 1 Answer