I’m loading in meshes at runtime, which works fine, but if I try to move the mesh to another object’s renderer, it won’t show up. If I don’t destroy tempObj, it sits at 0,0,0 with the model showing. The mesh shows up in this object’s Mesh Filter Mesh slot, but it just doesn’t show up in the world. It’s the same issue if I copy it between any gameObjects, but it’s fine if I instantiate a new object for it. I’ve tried this approach in a blank scene (with the path typed exactly) but it made no difference. Any help would be appreciated.
Instantiate tempobj; Add a mesh filter and renderer to it.
Add mesh filter and renderer to ‘this’
Get the mesh and material from tempobj
Problem is, you never assign a mesh and material to tempobj (tempobj.meshfilter.mesh = …)
if tempobj already has a meshfilter + mesh + renderer component, do not add new ones, just Get them
If I don’t add the MeshFilter and MeshRenderer to tempObj, I get an error saying “Object reference not set to an instance of an object” when I try to set ‘this’ filter and renderer to ‘tempObj’ filter and renderer. If I try making an empty GameObject first, giving it a renderer and filter, then loading in the mesh, it still gives me the error.
It’s either .fbx or .obj. The temporary object does have a mesh and material, because it shows up in the world with the model and mat visible. After I copy it to “this”, the model’s name appears in the Mesh Renderer box, but nothing appears in the view.
All I’m trying to do is load a mesh and give it to an existing gameObject. I haven’t been able to find a concise answer by searching; even Eric5h5 just said “instantiate as a gameObject” without much more elaboration in another thread.