Search Unity

Any way to set canvas settings for prefab mode?

Discussion in 'Prefabs' started by stopiccot_onthespot, Oct 16, 2018.

  1. stopiccot_onthespot

    stopiccot_onthespot

    Joined:
    Oct 1, 2016
    Posts:
    65
    When opening UI prefabs in new prefab only mode dimensions of my "Canvas (Environment)" node are 287x444 points which is waay to small. Any way to change that settings?
     
  2. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,615
    No, it uses a default Canvas which is based on the size of your Game View.

    You can however create a scene with a Canvas in it that fits your needs and assign that scene as the Environment Scene for UI Prefabs in the Editor Settings for the project.
     
  3. stopiccot_onthespot

    stopiccot_onthespot

    Joined:
    Oct 1, 2016
    Posts:
    65
    Thanks a lot, that's exactly what I was looking for
     
    LeonhardP likes this.
  4. RGV

    RGV

    Joined:
    Jan 25, 2016
    Posts:
    4
    What if you have different size needings for different UI Prefabs? I think I'm missing something because I can't figure out how Environment Scene works.
    I mean, I have a UI Prefab which must anchor to the whole size of whose parent. For instance, imagine a common shop Slot. The slots container will shrink & grow depending on the aspect ratio, so my shop Slop prefab must stretch to both axis. But it stretches to the "Canvas (environment)" size whatever the container size actually is.
     
  5. mmmathias

    mmmathias

    Joined:
    Oct 17, 2017
    Posts:
    1
    What if you have different size needings for different UI Prefabs?

    Thought about the same thing but atm. there seem to be no support for that.

    It works that you'll just need to add a Canvas to the scene and add the same Canvas Scaler as you are using in your regular scene. Then you'll observe that the prefab looks exactly the same in edit mode as in your scene.
     
    jrumps likes this.
  6. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,615
    If different Prefabs need different contexts, we don't have a great solution for that today. We're working on a feature called in-context editing which should address this better.
     
    tatulaine and HonorableDaniel like this.
  7. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,223
    It's very confusing that the scene view size of the canvas is tied to the resolution of the game view. Especially when the game view is set to free aspect, so dragging the game view around changes the scene view representation.

    I've found that in order to actually edit canvas prefabs well, I have to either be on a multi-screen setup (where the game view is on a secondary monitor), or lock the resolution of the game view.

    It would be nice to be able to tell the prefab view what resolution I want.
     
  8. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,814
    I just have my Game view tabbed alongside my Scene view. Works like a charm.
     
  9. DavidBarlia_AofL

    DavidBarlia_AofL

    Joined:
    Jul 10, 2019
    Posts:
    1
    This looked like just the solution I've been searching for... until I had a UI prefab nested beneath another UI prefab. When I open up the top-level prefab, everything looks great. When I continue into the nested prefab, all the alignments and sizing go wonky as they did before I created a UI Environment scene to match my game scene.

    My Canvas setup is using Screen Space - Camera, with a dedicated UI Camera in the scene.
    I'm using Unity 2018.4.2f1 on Mac.
     
  10. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,615