Mesh not rendering until focused on

Hi,

I have a very strange bug.

A script instantiates a prefab containing a mesh in our scene at run time (after some logic has been satisfied).

When this mesh is instantiated, it is initially not visible although the renderer is enabled. It remains invisible until I click on the mesh’s prefab instance in the heirarchy and press ‘F’ over the Scene window to focus on it. At this point, the mesh is visible and renders in the Game scene.

I can’t think how this behaviour can occur. Can anyone suggest what might be causing this or suggest how I might go about debugging it?

Cheers,
Tom

Does the prefab itself have a script? If so, does the rendering still have problems when you disable the script?

Is it a skinned mesh? If so, try the Update When Offscreen option in the skinned mesh component of your instance. That might help.

Cheers Andee,

Yes there was a script which I have disabled but this did not solve the problem.

There was also an animation that played automatically when the prefab is instantiated. When this was disabled it did appear (almost) instantly so I guess that animation is somehow reponsible for why the mesh was not rendering.

The only thing is that this has not been changed and it was working in previous versions. How can an animation affect rendering?

The mesh is a “plant” object which has a “grow” animation attached to it so that when it is added to the scene it grows into it’s final form. This animation has worked fine in previous versions of the project. I am not sure how it can stop the plant from rendering…and why would focusing on the gameobject make it render?

I cant find the Update When Offscreen option so I guess it is not a skinned mesh…

Cheers