I’m faced with an issue where I cannot set up a camera and assign it a specific ScriptableRenderPass through script. Currently, this is only possible through the Camera component UI. This regards a hidden camera controlled by a MonoBehaviour script, the user should not concern themselves with this camera.
This camera requires a ScriptableRendererData asset to be assigned. The only method do so is to call UniversalAdditionalCameraData.SetRenderer(int index). This apparently assigns a ScriptableRenderer from the pipeline asset’s m_RendererDataList. Though this list is marked as internal, so its impossible to query for the item I’m looking for, and its index. It seems the only way to use this function at the moment is through hard-coded indices.
For an automated setup in the context of asset store packages, this is troublesome. Adding renderers to the pipeline through script is also not possible because of the restricted access. Or implement errors/warnings if the required ScriptableRendererData isn’t assigned. Leaving the end user with no feedback as to why things aren’t working. In addition, no functioning demo scene can be presented, which is required.
Current workflow:
- Add a custom ScriptableRendererData asset to the pipeline asset
- Note the index it has in the list
- Set value on public int field on MonoBehaviour script (used for SetRenderer)
Paint point: requires user’s knowledge of the required set up steps.
Proposed solution:
Allow access to m_RendererDataList so renderers can be added, or their respective list index can be retrieved. Which subsequently allows SetRenderer to be used in automation.