Draw Target Object is a component for rendering a shadow of an object and its child objects onto a render texture at runtime. Add this component to a projector object.

Field Description
Target Set the target object of which you want render a shadow.
Render Children Set true if you want to render the children of the target as well.
Layer Mask Choose layers for children to be rendered (Applicable if Render Children is true)
Auto Detect Hierarchy Changes If enabled, changes of the hierarchy under the Target is checked every frame. If a Renderer is added/deleted/enabled/disabled, the command buffer in this component will be updated. Instead of enabling this property, you can manually call SetCommandBufferDirty() function when you add/delete/enable/disable a Renderer under the Target (recommended).
Texture Alignment Rotate the transform of the projector object so that the shadow image along specified axis of the target object can be aligned to Y-axis of a render texture.
Follow Target If true, the projector object will follow the target.
Update Function Choose a function where the transform of the projector will be updated. You don’t need to care about this field so much. You can always use OnPreCull. If you want to refer to the projector transform in Update or LateUpdate function of your script, you need to call UpdateTransform() of this component or SendMessage(“UpdateTransform”) to the projector object before you use the projector transform. In such case, it is a little bit better to choose UpdateTransform, otherwise the transform of the projector will be updated twice a frame. Fast Shadow Receiver components also refer to the projector transform. These components will send “UpdateTransform” message to the projector object in LateUpdate function. Please make sure that the transform of the target object is updated in Update function if it is required to update the transform of the projector in LateUpdate function.
Shadow Shader Choose a shader to render a shadow for opaque materials.
Replacement Shaders Set pairs of a render type and a shader to render a shadow for the render type.


3 thoughts on “Draw Target Object component

  • 2015/05/28 at 6:01 PM

    I have crash when I have Dynamic Shadow Projector in scene and try delete last camera on level.

    • 2015/05/28 at 8:26 PM

      Thank you for your feedback!
      What do you mean “last camera”? How did you delete it?

      • 2016/07/05 at 11:34 AM

        Now I understood what you meant. Unity Editor crashes when all the cameras are deleted from a scene. I sent a bug report to Unity. Thanks!


Leave a Reply

Your email address will not be published. Required fields are marked *

Anti Spam Code *