- Home /
No shadow cast after creating a gameobject during runtime
Hi guys ,
i have created in my project a spotlight and a cube that blocks part of the light and creates a shadow on a wall(another cube) when i make this in the editor everything works great .. but when i create that spotlight during game (instantiate) and then i create the cube (instantiate) ... the cube doesnt cast any shadows .. is there some script i need to use after instantiation ? thanks ;)
Just checking: are you Unity free or Pro? Have you looked at the cube in the inspector after instantiating to see if it has Cast Shadows turned on?
You say it looks good in the Editor - do you mean that after you hit Play it looks good, vs when you instantiate the exact some object in the same place it doesn't look good?
I am trying it now on my friends pc with Pro version ... and yeah i had a cube that casts shadows with a spotlight .. i made two prefabs one for the spotlight(attached on imported model) and one for the cube .... then i created a script that creates that model after a mousebutton click ... then when i have the model with the spotlight i created another script that places a cube in front of the model that should cast shadows but it didnt... and yes the checkboxes Cast Shadows are enabled ...