Cloned objects not appearing in game while in play mode

Hi all,

I just upgraded to Unity 2017.1. After upgrading my project, I tried to run it. I have a logic to instantiate 3d “tile” objects. The logic consists of doing GameObject.Find() to find the original object pre-fab in the scene, and then instantiating many times over in the different locations. This always worked in unity 5.1. Now, after I upgraded the project, the objects get instantiated, but I can’t see them when in game mode. I can see them in the hierarchy, and if I pause the game (while running in Editor), they become visible. Only when the game is running do they disappear. If I export the game, the exported game doesn’t show the objects either. I tried every possible combination of shaders to see if maybe something in the shader was preventing the objects from rendering, but nothing. All the cloned objects have their Mesh Renderer on, so that’s not problem either. Can anyone help?

The issue is not related to Unity 2017.1, it also happens on Unity 5.5.

This is so strange… i really don’t know why this happens.
I just upgraded to 2017 and except for some little things, all is working fine. And i use Instantiate a lot of times and i see no problems.

Did you made a backup before upgrading?
I recommend you to downgrade your unity again, check at last version you had if is still working, and do the upgrade again… maybe some code from unity went corrupted.

I normally Instantiate from a prefab, by its string name in my folder Assets/Resources. Is where i have all the prefabs, textures… everything that will be need “Loaded”.

ObjectPrefab = Resources.Load("PrefabStringName", typeof(GameObject)) as GameObject;
ObjectCreated = (GameObject) Instantiate (ObjectPrefab, Vector3Position, QuaternionRotation);

As loaded as string name, you can use other string variables to create the string prefab name, like this to Instantiate a prefab called “VehicleMasterFire”:

string level = "Master"
string type = "Fire"
ObjectPrefab = Resources.Load(("Vehicle"+level+type), typeof(GameObject)) as GameObject;

And for the “(Clone)” in the name, you can use the Substring function to change it name when is created