Hello,
I just started Unity and i am actually just training while completing tutorials.
Here is my issue : I created several pro builder game object that i disposed in order to create the shape of a wanted character in the scene. Then in order to use the renderer to change the material i created a parent object in which i added all the children objects.
Now i would like to change the material and color of the whole parent object using renderer tool but i am not able to do so since the parent object has no mesh filter. Based on my previous search i understood that the mesh is basically the shape used by unity to delimit the object in space for interactions with the environment, and it differs from the shape visible in the scene (thx to correct me if this is wrong).
When adding a mesh filter in the inspector window for the parent object, it is specified “none” and when i try to change the shape there is only basic shapes and i cannot modify them to fit the parent game object.
I understood that i had to use the pro builderize tool to make that mesh selecting the parent object which the object selection of probuilder but still i have errors concerning the children object already having their own mesh.
Instinctively i though that if all the children already had a mesh then making a parent object from them would automatically make a mesh for the parent using all of the children meshes but it seems its not how it works.
Could you tell me how to proceed ?
1 Like
A mesh can be used for either (depending on whether it has a renderer attached or a collider) but most of the time its going to be used for visuals
A mesh filter is generally paired with a mesh renderer to create the visual graphics. As for “interaction” that is typically done with a collider. Most times the collider is not a mesh, but rather a primitive collider like a sphere or box. The mesh used for graphics is usually too detailed to efficiently act as a collider.
There is such a thing as a “mesh collider” in which case it can use the mesh as a collider. These are usually used as level geometry. In this case, you’d usually have a simplified mesh with no renderer.
You are correct, that’s not how it works. The parent object does not have a mesh or a material. The only way to change the color is to change the color of the individual child objects. If you look at each child object in the inspector, you should see a mesh filter component (which is where the mesh is stored), and mesh renderer component on each of them. Each mesh renderer will have one or more materials on them and the material will usually have a main color depending on what type of material it is.
If you want to have a script on the parent object that sets the colors or materials of the child objects then you can loop through the children and access their individual renderers, or you can call GetComponentsInChildren<Renderer>();
to get an array of the children’s renders that you can loop through.
Edit: Oh, and if you’d rather combine the child meshes into a single mesh, Probuilder has a “merge Objects” feature. Have you tried that? You mentioned that your object is a character, though so maybe you want to keep them separate so the character can move his arms and legs, for example.