Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

UI prefab looks different when opening from project files compared to when in scene

Discussion in 'Prefabs' started by unity_JgTsTPV_3Rmwkg, Oct 20, 2020.

  1. unity_JgTsTPV_3Rmwkg

    unity_JgTsTPV_3Rmwkg

    Joined:
    Oct 20, 2020
    Posts:
    4
    Hi,

    So the issue am having is my UI prefabs for my game that are saved in the project file system when opened don't look right (see below). Even when dragged onto the scene canvas they stay broken (and also scales then by a factor of 27 for some reason)
    Untitled.png

    It is supposed to look like the following.
    Udntitled.png


    At the moment, to edit UI components, I have to copy it into the scene, edit it there, delete it in the main project file and save it as the new one.

    This a pain, as I have to reshape it every single time, and for every canvas component.

    Any thoughts on what is causing this would be appreciated.

    Thanks.
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,850
    It's not completely clear what the issue might be here, but my guess it it's related to this:

    UI Prefabs opened in isolation will be displayed in a Canvas that may have a different size than the Canvas in the scene. If there are scaling elements in the UI Prefab, that can make it appear different when displayed in a Canvas of a different size.

    In Unity 2020.1 and later, Prefabs in a scene can be opened in Prefab Mode in Context, which will display it in Prefab Mode in a Canvas of the same size as the Canvas in the scene. Hopefully this addresses the issue (if you're able to use 2020.1).
     
    unity_JgTsTPV_3Rmwkg likes this.
  3. unity_JgTsTPV_3Rmwkg

    unity_JgTsTPV_3Rmwkg

    Joined:
    Oct 20, 2020
    Posts:
    4
    Hi, thanks for the reply.

    The canvas it does open it up with does have different settings, but I am not able edit it. It is all greyed out.

    When I come back to my UI I will see if I can upgrade to 2020 (currently on 2018.4.23f1).
     
  4. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,850
    Yeah, you can only edit the Prefab itself in Prefab Mode. And the canvas is not part of the Prefab (it's part of the environment), hence can't be edited.
     
    unity_JgTsTPV_3Rmwkg likes this.
  5. unity_JgTsTPV_3Rmwkg

    unity_JgTsTPV_3Rmwkg

    Joined:
    Oct 20, 2020
    Posts:
    4
    Is there really no way to choose what environment it opens with?
     
  6. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,850
    unity_JgTsTPV_3Rmwkg likes this.
unityunity