I have a model with several empty gameObjects with several cubes in them, and I want to turn off casting shadows just for those cubs in those empty gameObjects without going in and manually disabling all of them(not during runtime).
Is there an easy shortcut I can do to accomplish this, or do I need to use a script/do it manually?
public class JustModifyMeshRenderers : MonoBehaviour{
public bool castShadowsInChildren;
void OnValidate()
{
//and here get the children and modify it using the castShadowsInChildren value
//when you modify in the inspector the value of the boolean you will run this function
copy all empty game object that contain cubes into separate scene ( )
in hierarchy tab in the search bar type t:meshrenderer (this will get you the list of game objects with mesh renderer component on them)
select all game objects in the list (in the inspector tab you will get mesh renderer component display )
in cast shadows field select off (clear the field in the search by clicking x), so the original hierarchy view returns
select and paste those back in the origin scene
If your cubes have “cube” in their names you can isolate them in search by typing “t:meshrenderer cube”, and don’t need to copy them to another scene
here is the screenshot