Unity 5.4 - Instantiated Objects Invisible
As the title states, objects I'm instantiating during runtime are quite simply not visible. Now, don't get me wrong - they exist! They just don't appear on screen.
They appear in the hierarchy, have all the properties they're supposed to have, you see where I'm going. Yet somehow, they're invisible. The situation upon instantiation through a script:
When I do it by simply dragging the object into the scene from the asset folder:
If anyone has any suggestions at all they'd be greatly appreciated. None of my scripts touch any render-related sides of these prefabs, so I really don't know what could be causing this. (Keep in mind, layers or stuff like that aren't the issue - it only bugs on instantiation!)
Edit: This issue occurs both in scene and game view, by the way - it's not linked to some broken camera settings or alike.
This is also happening for us in 5.4 in places where it did not happen before (at least in 5.2.2). For us, it is happening with UI elements that are instantiated at runtime. It is not consistent since it only happens some of the time. Our current bandaid fix is turning the GameObject off and on as soon as it is instantiated.
I tried recreating this in a test project, but I couldn't. I'm not sure what variables could lead to this happening.
Answer by OsmiousH · Aug 18, 2016 at 04:09 AM
I cannot Answer You CLEARLY due to the lack of attached Scripts but my guess is that you must have Instantiated It wrong To Instantiate an Object Use this
//javascript
public var IObject;
Instantiate(IObject);
//C-Sharp (Might contain errors)
public Object IObject;
Instantiate(IObject);
If error continues :
Check If The Object Is In current scene Check to see the Instantiated Object's transforms
IF THIS DOESN'T WORK :
Provide a copy of your scripts by editing the question
He's clearly instantiating the objects, so that shouldn't be the issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220612090901im_/https://answers.unity.com/themes/thub/images/avi.jpg)