Search Unity

Better UI

Discussion in 'Assets and Asset Store' started by Hosnkobf, Jan 30, 2017.

  1. nooxouille

    nooxouille

    Joined:
    Aug 29, 2018
    Posts:
    24
    [May you excuse my double-post]

    So, I am taking the time to repro the issue, but following the instructions you provided me.
    When you say
    you are referencing to adding the correct (4:3) screen configuration to the Rect Transform Override, editor wise ? Or do I need to write some code to actually make this work ?
    And If I've understood this correctly, I now that I am working on the correct script configuration because, amongst others, it have an fulfilled white losange with an asterisk next to it's name ?

    [EDIT] Ook, I think I actually have an issue with the way I set a screen configuration setting. What would be the correct way to create such setting ?
     
    Last edited: Feb 15, 2022
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    I'm talking about this: https://documentation.therabytes.de/better-ui/SizeConfigCollections.html
    You don't need to write any code.

    Probably yes, but I am not sure where you see that symbol... The "best matching screen configuration" is always expanded in the size config collections (that thing that I linked above).

    However, to make really, really sure you are working on the correct screen configuration, use the Pick Resolution window. there you can explicitly activate one of your screen configurations (you will see
    ♦*
    or
    ◊*
    in front of it as long as it is ensured to be active).
     
  3. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Because the Wizard doesn't provide aspect related screen configs, you need to do it manually.
    Please refer to the documentation (mainly to set up the fallbacks right).

    your configuration should look like this (I did it for portrait and landscape, you may only need one of them):
    upload_2022-2-15_11-21-8.png

    Note that I didn't change the optimized resolution / dpi. It is likely that you also want to use your fallback values here unless you want to replace all your sprites for this resolution.
    Also note that I did not specify a fallback order, since I don't know which screen configs you have in your project and which fallback order would make sense. Also note that you probably want to move them to the very top of your configurations (rule of thumb: least probable -> top most)
     
  4. nooxouille

    nooxouille

    Joined:
    Aug 29, 2018
    Posts:
    24
    Alright, so it seem that this is working and, well ... that my mistake was to put the iPad Pro resolution values within the optimized resolution fields.
    The setting you provided seem to work, although I need to make the fallback logic correct.
    And so far, no crash manipulating the elements (in the newly created empty project tho).

    Thank a lot for the more detailed explanations.
     
    Last edited: Feb 15, 2022
    Hosnkobf likes this.
  5. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    Hi @Hosnkobf

    I tend to move all my 3rd party plugins into separate folder. But whenever I restart the Unity, Better UI reopens the Setup Wizard and then creates ThereBytes folder again in the Assets root with some config wizard file. Can you please fix that so it respects its current location and not assume it's in the default one?
     
  6. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @iMobCoding

    I really understand you. I also was always annoyed by the "freedom" of unity asset publishers to put their files whereever they want (And some assets are really overuse this freedom by creating multiple folders in the root level). I wish there were a dedicated folder where all the third party stuff is put into.

    However, for files which are auto-generated I need to somehow know where they are located. Therefore they have a fixed path. I will research if I can make this path flexible somehow but I am not sure if this is easily doable. Until then, you can change the paths manually:

    open
    ResolutionMonitor.cs
    and change the first property in the class:
    Code (csharp):
    1. static string FilePath { get { return "<MyParentFolder>/TheraBytes/Resources/ResolutionMonitor"; } }
    likewise the
    Materials.cs
    :
    Code (csharp):
    1. static string FilePath { get { return "<MyParentFolder>/TheraBytes/Resources/Materials"; } }
    In
    SetupWizard.cs
    change the filePath variable in the getter of StaticPersistentWizardData (line 25):
    Code (csharp):
    1. string filePath = string.Format("{0}/<MyParentFolder>/TheraBytes/BetterUI/Editor/setup~.wizard", Application.dataPath);
    This should solve it for you. (of course you have to replace
    <MyParentFolder>
    with the folder name you use as parent)
     
  7. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    Thank you, it works :)

    How about making some arbitrary file in your TheraBytes folder, find it when needed and then form all other paths relative to that one?
     
  8. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    This would be one solution, yes. But I don't like it very much because it would be an expensive operation and I would need to add some sophisticated logic to not trigger the search too often. Also, it might find a file with the same criteria in the project (not likely but possible).

    I have something different in mind: I add another setup-wizard page which allows you to move the whole asset to a specific folder. This would overwrite a class file which simply contains the path-strings. This way I wouldn't need to change any logic (except from retrieving the paths from that class) and just add some logic for the move-feature.
     
    theforgot3n1 and iMobCoding like this.
  9. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    I am proud to announce that February 2022 was the strongest Month for Better UI yet in terms of sales count.
    We decided to donate all the income of that month to help Ukraine.
     
  10. huangdongxc

    huangdongxc

    Joined:
    Mar 22, 2020
    Posts:
    6
    I got an error.

    Assets/TheraBytes/BetterUI/Runtime/Scripts/Utils/ResolutionMonitor.cs(496,31): error CS0234: The type or namespace name 'PrefabStageUtility' does not exist in the namespace 'UnityEditor.SceneManagement' (are you missing an assembly reference?)

    Unity Version: 2020.3.26f1

    upload_2022-3-11_18-10-42.png
     
  11. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @huangdongxc

    I installed Unity 2020.3.26f1 and opened a better-ui test project with it. Unfortunately, I do not see any errors. I am also clueless what could cause the non-existence of the PrefabStageUtility.

    However, you can fix it by disabling adaptive size previews in prefab stages completely.
    Just replace the line above the error (line 495).

    replace
    #if UNITY_EDITOR && UNITY_2018_3_OR_NEWER

    with:
    #if false
     
    huangdongxc likes this.
  12. makaolachsiungca

    makaolachsiungca

    Joined:
    Sep 27, 2019
    Posts:
    31
    Unity 2022.1.0b
    Editor will crash when converting TMP,
    all gameobject and from root transform in scene include prefab were gone
    螢幕擷取畫面 2022-03-21 214723.png
    螢幕擷取畫面 2022-03-21 220242.png
     
  13. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Thanks for the report. I will investigate this.
    Please note that you are working with a beta version of Unity. So, this might be a problem of that unity version (which might get fixed by unity) and may not be possible to fix in Better UI (but I will find out about this).
     
    makaolachsiungca likes this.
  14. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi again @makaolachsiungca

    I tried to reproduce the issue with Unity 2022.1.0b and TextMesh Pro 3.0.6, but it works for me.
    Can you provide detailed steps to reproduce?
     
  15. makaolachsiungca

    makaolachsiungca

    Joined:
    Sep 27, 2019
    Posts:
    31

    I think it might be unity problem
    It also happened while editing the component prefab in scene with other plug-in.
    Once unpack the prefab, it works fine.
     
    Hosnkobf likes this.
  16. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    326
    2022.1b14
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TheraBytes.BetterUi.Editor.ResolutionPicker.OnGUI () (at Assets/TheraBytes/BetterUI/Editor/Scripts/Windows/ResolutionPicker.cs:147)
    3. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <6d6cd9fc41404fa29c2da51dc4302730>:0)
    4. UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <6d6cd9fc41404fa29c2da51dc4302730>:0)
    5. UnityEditor.DockArea.OldOnGUI () (at <6d6cd9fc41404fa29c2da51dc4302730>:0)
    6. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    7. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    8. UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    9. UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    10. Rethrow as ImmediateModeException
    11. UnityEngine.UIElements.UIR.RenderChain.Render () (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    12. UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    13. UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    14. UnityEngine.UIElements.Panel.UpdateForRepaint () (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    15. UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    16. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    17. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    18. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    19. UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <a2769450850a4ff38a8451b8cd256ee7>:0)
    20. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <550cf7d7b70f452f992b3646b82474cf>:0)
    21.  
     
  17. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @Slashbot64
    Thanks for the report.

    To fix it, open
    ResolutionPicker.cs
    and change line 112
    from:
    Code (CSharp):
    1.             selectedIndex = gameView.GetType().GetProperty("selectedSizeIndex", BindingFlags.Instance | BindingFlags.NonPublic);
    to:
    Code (CSharp):
    1.             selectedIndex = gameView.GetType().GetProperty("selectedSizeIndex", BindingFlags.Instance | BindingFlags.Public);
    (NonPublic -> Public)
     
  18. mikeyng

    mikeyng

    Joined:
    Sep 20, 2019
    Posts:
    4
    I emailed the company, but maybe I'll get a better response here?

    I have some buttons that I am making bigger via animation. After I click the button, I want them to return to their initial state. Is there a trigger or something to tell BetterUI to do that?

    Right now the buttons stay big after I click them. I've tried to add another animation to make them normal sized again after I push the button, but it winds up "locking" the button into its normal size. There's some flickering going on, so I think it's switching between two animations or something. If there were a way I could reset or restart the button, I think that'd be best?

    Thanks in advance!
     
  19. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    hi @mikeyng

    I'm not quite sure about your setup and what causes the problems you face, I am also not sure about the behavior you want to achieve.
    If you want to have an animation which scales down when pressing the button and back to the initial scale when released, you probably want to have an animation assigned to the Pressed and Selected transition. Note that you should use
    [ Any Location ]
    as start for both, otherwise you will see jumps in size. Also note that if you click very quick, you will barely see the animation.

    If you want to trigger an animation that scales and then returns to the initial state, you have two options: Either you make two animations and trigger the second one through the
    Action After Finish ()
    of the first one, or you have one animation and adjust its curve in a way that it goes from 0 to 1 and back to 0.

    Hope this helps. Otherwise, please show some screenshots of your setup or a video or describe the problem in more detail.

    PS: I found your mail. It was in the Junk folder for some reason.
     
  20. mikeyng

    mikeyng

    Joined:
    Sep 20, 2019
    Posts:
    4
    I have two animations: "Make Big" and "Return to Normal"
    when the player hovers over a button, I want it to get a little bigger, so I have "Make Big" trigger on highlighted.

    If the player selects one of the buttons, I wipe their choices and give them new ones on the buttons. This where the issue is. The button stays big even after I clear the text that was there before.

    I've tried putting "Return to Normal" on Pressed and Selected also (just curious what the difference is). The issue then is that it never goes to "Make Big" again. (I see a little flickering, so I think it's trying to do two things?)

    If I could revert the button to its Initial State, I think that would address things. Other than destroying and recreating the object - is there a way I could reinitialize the script?
     
  21. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Please try the following: assign "Return to Normal" to the Normal State of your transition. When you wipe the choices, you should reset the selected control, so that it is not "selected" anymore but "normal". To do this, call
    UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);


    The "Pressed" state is triggered when you pressed down the mouse button while the mouse is at the object (and as long as it is pressed and at the object).
    The "Selected" State was introduced by Unity in version 2019.1. When you release a pressed selectable, it will transition to this state. It will remain in this state until you click somewhere else (and the selected game object becomes something different). I think, this was introduced for Gamepad input (so, you see what is currently focused), but is a bit annoying for mouse interaction. I have on my list to create a "BetterEventSystem" that can automatically deselect objects when interacting via mouse (or omit transitions to the "Selected" state). But I didn't even make enough research yet, if or how this could be implemented (so, no promises).

    I don't know why you see flickering. What can happen is that the cursor moves into the clickable area because of the animation, then triggers another animation causing the clickable area to move outside the cursor position and so forth. I don't think this is causing your specific observation, but if so, you could prevent this by not animating the button itself, but a child of it. this child should have "Raycast Target" disabled for all components. The Button (or another child) could have an "Interaction Area" component, which does not animate, to detect the cursor.

    As I wrote above, resetting the selected game object should do the trick.
    However, you can also change the location data manually by code or a Unity Action.
    Just call:
    myLocationAnimation.SetToLocation("Location 1"); // replace with the names you are using
     
  22. mikeyng

    mikeyng

    Joined:
    Sep 20, 2019
    Posts:
    4
    Thanks! The call to set the selected game object to null did exactly the trick.
     
    Hosnkobf likes this.
  23. SpaceShaman

    SpaceShaman

    Joined:
    Sep 29, 2016
    Posts:
    6
    Hey, new here. Trying to use the Better Content Size Fitter, which seems great, but doesn't update on its own as I turn objects on and off under its reference object. I need to change its settings and back for it to update itself in editor.

    Any solution to this?
     
  24. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @SpaceShaman,
    Actually, I am not quite sure about your setup. Usually, I use it in combination with a layout group. So, that you have an object with the better content size fitter, as a child a Layout Group (like "Better Axis Aligned Layout Group") and several children there. Is this what you do as well?
    If I put the layout group object into the target field of the better content size fitter, it updates. In some cases, the layout group object needs another "Size Change Tracker" component which references the content size fitter.
     
  25. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    I think there's a Bug if you use Unity Sprite Atlas.
    Not sure if this works on all cases.
    The issue is when you go in runtime mode.

    Possible fix ?
    Code (CSharp):
    1. new Vector2(base.overrideSprite.rect.width * scale.x, base.overrideSprite.rect.height * scale.y));
    2. //new Vector2(base.overrideSprite.textureRect.width * scale.x, base.overrideSprite.textureRect.height * scale.y));
     
  26. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @OscarLeif,
    Thanks for your suggestion. Just from looking at it, this looks good.
    However, I am a bit puzzled what issue you are facing. I use Better UI with sprite atlasses all the time and didn't run into any issue yet.
    Can you explain the symptomps a bit better?
     
  27. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    Oh sorry I forgot to give the details.
    OK this is the Case.
    I want to use a slice Image with borders.
    We use A "Better Image" component.
    for the source image we just use a slice image with border.
    Apparently in the editor mode it works fine.
    But if you run, game it will fail render a bad image.
    This is my settings for the component.
    upload_2022-5-27_13-12-39.png
    This is how My Game looks on Editor Mode.
    upload_2022-5-27_13-13-36.png
    And this is how Looks after enter play mode.
    upload_2022-5-27_13-14-15.png

    What I suggest to change was in the script.
    Code (CSharp):
    1. public class BetterImage : Image
    2. {
    3.   void GenerateSlicedSprite(VertexHelper toFill)
    4.         {
    5. border = GetAdjustedBorders(border / pixelsPerUnit, rect, KeepBorderAspectRatio,
    6. //                new Vector2(
    7. //                    base.overrideSprite.textureRect.width * scale.x,
    8. //                    base.overrideSprite.textureRect.height * scale.y));
    9.                 new Vector2(
    10.                     base.overrideSprite.rect.width * scale.x,
    11.                     base.overrideSprite.rect.height * scale.y));
    12.         }
    13.  
    14. }
    After change the "textureRect" to "rect" it will just works fine.
    Right this only happen when you enter on the play mode.
    In a real time device the result is the same as enter in play mode.

    My image was packed in an Unity Sprite Atlas, but I don't know why when read the textureRect it just returns 0.
    I didn't test all possible cases.

    After that small change the image will look fine.
    upload_2022-5-27_13-30-20.png
     
  28. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    208
    I want to set the material effect of the BetterImage component through script. The only way to do so, I think, is to set image.MaterialType = "Grayscale". Could you modify the API for setting the material of the BetterImage component to not rely on a string but rather an enum or smth like that?
     
  29. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    @OscarLeif: Thanks for the insights. Strange that this never happened to me. I will try to reproduce it and figure out if your solution is the correct approach.

    @theforgot3n1: The materials are defined in a scriptable object called "Materials". Theoretically, everybody could add their own materials there and change the material type by assigning their chosen name for it. So, I cannot restrict this to an enum without dropping support for custom materials. What I could do instead is defining the pre-defined materials as constants somewhere (so you can write something like
    image.MaterialType = Materials.Grayscale;
    ). Would this be fine for you?
     
  30. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    208
    That sounds great.

    EDIT: I also found a bug with the BetterImage component. When setting betterImage.sprite = [image] in code, it does not properly update the component. If you set the image via code then enable and disable, the component will be reset back to whatever it was before you set it.

    My specific setup is having a prefab with lots of images. All of them are set by code before being shown. Setting the image does change the image, but it does not persist over enables/disables.
     
    Last edited: Jun 5, 2022
  31. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    @theforgot3n1 does this also happen if you additionally assign the current Sprite setting's Sprite as described here?

    (PS: I already implemented a more intuitive way where Better UI assigns both sprites for you when you set
    myBetterImage.sprite
    . This will be part of the next version.)
     
    theforgot3n1 likes this.
  32. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    I organize some Images files and found this.

    For example my original button image size is 502*502
    I have this settings.
    Image type is "Sliced"
    Keep Border Aspect Ratio "Enable is true".
    Image is outside Unity Atlas Texture.
    Image in Atlas Texture: NO
    upload_2022-6-6_20-31-54.png
    Now lets Use the same settings but lets change the Max Size.
    lets say 256.

    The result is bad.
    I think the issue is here. we cannot change the size of the Image using Unity Import settings.
    It will make bad results.
     
  33. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    @OscarLeif
    Thanks for the report. I will investigate this after my holidays.
     
  34. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    208
    Found an issue with the CopyTo function in VertexMaterialData.cs. When used on "Standard" material, for example (it has to not have any properties in the materials scriptableobject), it will cause a null reference exception. For some reason the FloatProperty[] field is null unless you specifically open the materials scriptable object in the inspector, which populates the array field with an empty array as expected.

    The fix is not the most elegant but it works. I added an initialization to the field, so on line 234 in VertexMaterialData.cs I changed the FloatProperties line to
    public FloatProperty[] FloatProperties = Array.Empty<FloatProperty>();
    .

    Thoughts on this issue @Hosnkobf. You can recreate it by calling
    iconImage.MaterialType = "Standard";
    for example.
     
    Hosnkobf likes this.
  35. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Thanks for the report.
    I added it to my backlog.

    And sorry that there are no updates currently. We are currently very busy with our game that should go into early access in September. So, I'm afraid I don't have time for updating better UI before Q4-2022.
     
  36. ArtemBernstein

    ArtemBernstein

    Joined:
    Jun 20, 2021
    Posts:
    1
    Hello

    I have an issue with Size Modification (on every component that has this setting)

    If I change mode or impact on non-fallback config, it changes them for every other size config collection too. Only fallback config keeps it original settings.

    Unity version: 2021.3.1f1 (also tried it on 2021.1.7f1, same behavior)

    It worked fine before (or I just did not notice), but now even if I create a new project the same thing happens.

    Is it intended behavior?
     
  37. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @ArtemBernstein,

    I tried to reproduce your repot with unity 2018.4 and 2022.1 (because I don't have the versions installed you mentioned, and this should not depend on the unity version).

    Unfortunately, I couldn't reproduce it. I created two sliced images and added another screen configuration to them (the same to both). Then I changed the sizes as well as the size modification values of that screen configuration of one of them. It affected only the one I changed, not the other one.

    Maybe you can provide me a step by step explanation how I can reproduce the bug?
     
  38. atnicoconut

    atnicoconut

    Joined:
    Apr 8, 2022
    Posts:
    11
    Hello,
    First of all, thanks for this amazing tool. It's been really useful in our project.

    However, now I've moved onto the dynamic resolutions stage, and I just can't get it to work. I've followed the tutorials and documentation but it seems there's something wrong on my project.

    I've added the better locztor component to the objects I'd like to adapt, and a new entry for my non-fallback resolution. Auto-pull is selected(though I've tried other configurations as well), but changing the object's position/anchors/size doesn't seem to be registering correctly. As in, all modifications affect all resolutions.

    The better locator components do seem to register the change in resolution correctly, and they do seem to pull correctly as well, but the diamond shape next to the resolution name always has an asterisk* next to it. As if it wasn't saving? In the video tutorials you don't seem to have that asterisk there. I believe I have everything else set up correctly, and I've done some tests on sample projects as well, but had the same results. Would you happen to know what the issue is?

    Some info:

    Unity version: 2020.3.33f1
    Screenshots:
    Capture d’écran 2022-08-09 114755.png Capture d’écran 2022-08-09 114816.png Capture d’écran 2022-08-09 114919.png

    Thanks a lot!
     
  39. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @atnicoconut
    Thanks for your kind words. Unfortunately, I didn't understand what you mean when you say you cannot get it to work.

    But I can give you some hints based on your confusion points and screenshots.

    The asterisk* symbol means that you are simulate that screen-configuration. You can simulate any kind of screen configuration even if you cannot fulfill all requirements on your machine (e.g. if you have one for touch screens). You probably clicked the Name of the screen configuration in the Resolution Monitor or the Pick Resolution Window. So, It doesn't tell you that it isn't saved, it tells you that you forced this to be active. See the documentation for more information.

    In the screenshot of your canvas, I can see that you scale with screen size. Unfortunately, this fights with Better UI's sizing. As stated in the Known Issues you can only use "Constant Pixel Size" when using sizing features of Better UI. This is only relevant for Better-UI-Components that have Size Modifiers. For everything else it doesn't matter (FYI: Better Locator doesn't have Size Modifiers, so it doesn't matter here). If you want to use "Scale With Screen Size" and also want to use components that have Size Modifiers, you need to remove all Size Modification entries from the Size Modifier, so that the Canvas Scaler can properly step in.
     
  40. atnicoconut

    atnicoconut

    Joined:
    Apr 8, 2022
    Posts:
    11
    Thanks for the quick answer!
    Ah, I see! Yeah, I was indeed clicking on the screen configuration, and not the actual screen size. However, now the new sizes aren't being detected by the better locator(it's always registered as the portrait fallback, even if I choose a resolution marked as landscape). Why could that be?

    About the canvas mode, I'm aware. But since I've worked with the old GUI before buying BetterUI, I don't really plan on using any Better components that mess around with size modifiers. I did test with constant pixel size though. But thanks for the tip :)
     
  41. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hmmm... maybe the resolution is not properly applied. Try focusing the Game-View and then the Scene-View again and see if the resolution is properly changed then. (This was an issue with older Better UI versions. I thought I fixed this already for version 2.4 but maybe I'm wrong and this fix was not published yet).
     
  42. atnicoconut

    atnicoconut

    Joined:
    Apr 8, 2022
    Posts:
    11
    Ah! I'm not sure what I did, but I was working on other things and now I've tried again and it works perfectly. If I come accross this bug again I'll try to narrow down what caused it and report back. Man I love the dynamic UI! It's so easy to use, now that I'm actually using it correctly haha
    Thanks :)
     
    Hosnkobf likes this.
  43. atnicoconut

    atnicoconut

    Joined:
    Apr 8, 2022
    Posts:
    11
    Hey! So, I've come accross the bug again, and I'm pretty sure it happened when I tried to add a Better Locator to an object + a new rect transform override on it while being in a resolution that's not the fallback. As in:
    - My fallback is portrait
    - I was in a landscape resolution
    - I added a better locator component to an object
    - And then added the "landscape" override on it

    Still not sure how to get it to work again, but I'll report back when I do!

    EDIT: It seems like removing the "Aspect ratio" option in the resolution monitor did the trick. Could've been just the fact I was changing/resetting the configs in general.
     
  44. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Ah, I think I know what's the problem:
    1. You add the better locator and auto pull is on by default. This means that your Fallback-data will retrieve the current rect transform data instantly.
    2. You add a "Landscape" setting to it. It detects that the current resolution is "Landscape" so, it sets the added setting active and also pulls the transform data into it.

    Result: Both, Portrait (Fallback) and Landscape have the same data.

    Is this what you experienced?

    I already have an idea how to solve it:
    If there is no setting for the currently active screen configuration in the better locator, auto pull is disabled and a button is shown with a text like "Add Landscape setting" to give a hint to the user that some additional setup is probably required.
    When there is a setting for the active screen configuration, Auto-Pull is enabled again automatically.
    Do you think this would be a better workflow?
     
  45. atnicoconut

    atnicoconut

    Joined:
    Apr 8, 2022
    Posts:
    11
    I don't think so, the behavior I get is:
    - In the better locator(and all other components that change based onr esolution), changing resolutions don't get detected in the UI. So, for example, portrait would remain open and with a white diamond, while landscape would remain an empty diamond, no matter what resolution I choose
    - HOWEVER, the text inside the dropdown in the better locator does change from active/inactive when choosing other resolutions. As in, it changes from gray/deactivated to white/active. Even if the diamond symbols don't change and I don't get the automatically opening/closing of the dropdowns. I also don't think it actually works.

    I'd add screenshots but I don't have the bug right now, I hope I was clear enough.
     
  46. wbourchier

    wbourchier

    Joined:
    Feb 4, 2018
    Posts:
    6
    Hi there, just starting to dig into this tool and so far it looks like a gem, so thanks! I had a quick question about the Optimized Screen Size setting. I set it to 3000x1500 as that is size I tend to work at. Take the example of a simple login screen I've attached, the Login Button has a better textmeshpro text label on it, given that the game view is set to 3000x1500, why is the Optimized Font Size double the CurrentValue (circled)? I would expect it to be the same. Perhaps I'm misunderstanding something simple. Any pointers would be appreciated :).

    upload_2022-9-2_11-29-47.png

    EDIT (Additional Info): Interestingly when I'm in Play Mode, the current value does match the optimized value (see pic)

    upload_2022-9-2_11-58-34.png

    FURTHER EDIT (Resolved): After exiting play mode it is now fixed in edit mode too, so it now all makes sense to me, not sure why entering play mode solved the issue, but posting in case it helps someone else :)
     
    Last edited: Sep 2, 2022
    brunoliveiraaraujo likes this.
  47. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @wbourchier
    Thanks for the kind words.

    It is very strange that it isn't applied immediately. I'm glad that you found a workaround. If it ever happens again and you can reproduce it, please let me know.
     
  48. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    I'm proud to announce that Better UI is in a Humble Bundle right now.
    Pay $30+ to get it along with many other cool unity extensions!

    Link to the Bundle
     
  49. mateusthiago

    mateusthiago

    Joined:
    Dec 13, 2018
    Posts:
    4
    Hello, I just tried installing it for the first time and got these errors:

    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\StaticSizerMethod.cs(28,22): error CS0029: Cannot implicitly convert type 'System.Type' to 'Type'
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\StaticSizerMethod.cs(35,35): error CS1061: 'Type' does not contain a definition for 'GetMethod' and no accessible extension method 'GetMethod' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\StaticSizerMethod.cs(29,16): warning CS0472: The result of the expression is always 'false' since a value of type 'Type' is never equal to 'null' of type 'Type?'
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\SingletonScriptableObject.cs(87,22): error CS0029: Cannot implicitly convert type 'System.Type' to 'Type'
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\SingletonScriptableObject.cs(88,26): error CS1061: 'Type' does not contain a definition for 'GetProperty' and no accessible extension method 'GetProperty' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ScreenType\ScreenTypeConditions.cs(107,40): error CS1929: 'Type[]' does not contain a definition for 'Contains' and the best extension method overload 'ParallelEnumerable.Contains<Type>(ParallelQuery<Type>, Type)' requires a receiver of type 'ParallelQuery<Type>'
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(219,36): error CS0037: Cannot convert null to 'Type' because it is a non-nullable value type
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(100,51): error CS1503: Argument 2: cannot convert from 'System.Type' to 'Type'
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(448,47): error CS1061: 'Type' does not contain a definition for 'GetMethod' and no accessible extension method 'GetMethod' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(528,79): error CS1061: 'Type' does not contain a definition for 'GetMethod' and no accessible extension method 'GetMethod' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(550,49): error CS1061: 'Type' does not contain a definition for 'GetField' and no accessible extension method 'GetField' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(570,37): error CS1501: No overload for method 'GetType' takes 1 arguments
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(575,65): error CS1503: Argument 1: cannot convert from 'Type' to 'System.Type'
    Assets\TheraBytes\BetterUI\Runtime\Scripts\Utils\ResolutionMonitor.cs(568,17): warning CS0472: The result of the expression is always 'false' since a value of type 'Type' is never equal to 'null' of type 'Type?'
    There are inconsistent line endings in the 'Assets/TheraBytes/BetterUI/Runtime/Resources/Materials/HueSaturationBrightness.shader' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
    There are inconsistent line endings in the 'Assets/TheraBytes/BetterUI/Runtime/Resources/Materials/Standard.shader' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
    There are inconsistent line endings in the 'Assets/TheraBytes/BetterUI/Runtime/Resources/Materials/ColorOverlay.shader' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
     
  50. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi @mateusthiago,
    It looks like you have a class in your project which has the name
    Type
    and is not in any namespace. Is this the case?
    I would recommend putting everything inside namespaces to avoid such problems.

    What probably can also fix it are assembly definition files. I hope this works although your project cannot compile:
    In the project browser navigate to
    TheraBytes/Packages
    and doubleclick
    asmdef_excl_TextMeshPro
    . Confirm importing the asmdef files and wait for unity to recompile.
    Please let me know if this fixes the error.