Search Unity

World Space Canvas in a Prefab

Discussion in 'Prefabs' started by jason_sone, Feb 4, 2019.

  1. jason_sone


    Jul 7, 2017
    Hi. New developer here with a question. I don't know if this has already been asked, but after 2 days of searching various phrases, I thought I'd bring my question here. I have a prefab with a video player component placed on a quad. I want to add play/pause controls (I already have the script, so no help needed there). I'd like the controls to appear over the video quad, which makes me think I need to render the canvas in world space. However, it requires a camera and my main camera is not a part of the prefab. How can I place a world space canvas in a prefab like this? For what it's worth, this is for an image detection scene using ARKit and ARCore.

    If this question has already been answered, a link would be welcome and I apologize for the duplicate question.

    I'm using 2018.3.4f1.

  2. runevision


    Unity Technologies

    Nov 28, 2007
    If there is an instance of the Prefab in the scene at edit time, assign the camera there so it becomes an override.

    If the Prefab is instantiated at runtime, have the script which instantiates the Prefab also assign the camera to the Canvas.