Search Unity

GUI [Released] Advanced Procedural UI Generation! Create, modify, animate UI, even at runtime

Discussion in 'Tools In Progress' started by Isfaq, Mar 14, 2020.

  1. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Hey, sorry I did not understand the issue the first time. I will look into it.
     
  2. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Hi, thanks for letting me know about the error. I'll fix it. I'm not sure about the warning though. Those variables are being used in the editor, they are just not directly referenced. I'll see what can be done about those.
    I am about to introduce a new gradient component soon. It will be more optimized then.
    Thanks again :)
     
    Klausology likes this.
  3. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    MPUIKit v0.99 is now available.

    Bug Fixes
    - Creating MPImage/MPImageBasic while being inside the prefab not working correctly
    - Utility window throws an error if there is no resource folder in the root directory
     
    Klausology likes this.
  4. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    The outline colour on MPImage Basic isn't rendered correctly.

    Screenshot 2021-03-18 110143.png
     
  5. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Thanks for reporting. I am looking into it.
     
    Carwashh likes this.
  6. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I know this doesn't really affect anything except tidiness of the console, but I'm getting around 15 "the field .... is never used" warnings in the console with the latest version of MPImage .99, and Unity 2020.2.7.
     
    Last edited: Mar 19, 2021
    Carwashh likes this.
  7. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    I've just updated to v0.99.3 which says the outline bug on MPImage Basic is fixed, but I'm still getting the issue. I just imported over the version already imported.

    Screenshot 2021-03-26 113101.png

    Additionally, is it possible to hide the Utility Panel? I don't need it to show every single time I launch a project using MPUI.
     
  8. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Hi, I just imported the latest package in an empty project and tried to recreate this issue but I could not. Is it happening only for this particular color?
    On a previous version, the outline color was compressed internally to fit all the data into the vertex stream. But in current version, the color is not compressed anymore, so this issue should not occur.

    The panel should only show when the package is imported into the project. It should not show every time you open unity. If that is not the case, then I suppose EditorPrefs are somehow getting cleared. The Utility window keeps a bool to check if it has been shown once and doesn't show itself again. If you can't investigate the EditorPrefs, you can comment out line 22 in MPUIKitUtilityWindow.cs file and it won't show again on startup.
     
  9. MEEMEEMAN

    MEEMEEMAN

    Joined:
    Apr 28, 2019
    Posts:
    2
    Hey ive found this bug where if you set the gradient of a sprite from an atlas, the coloring percentage is relative to the entire atlas texture rather than the sprite. tested with version 0.99.3.
     

    Attached Files:

  10. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    It's all colours. I've tried the latest version in an empty project, and the issue isn't happening.. so it's something wrong with this specific project. Not sure what though - maybe I'll just use MPImage for this project.

    I removed MPUI from the project and re-imported it.. the panel no longer gets displayed all the time. Hoped doing this would fix the colour issue too, but no luck.
     
  11. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi, a small thing you may want to fix for consistency:

    In the AddComponent menu for MPImage, you have UI > MPUI > MPImage, but for MPImageBasic, you have Scripts > MPUIKit > MPImageBasic

    Also, in .99.4 the shaders are not compiling due to assuming I have SoftMask installed, which I don't. I had to comment out all SoftMask lines in both MPImage and MPImageBasic shaders to get them to compile.
     
    Last edited: Mar 29, 2021
  12. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Thanks for reporting in detail. I'll check this out and fix it in a future update

    Edit: I have fixed the problem and it will be available in the next update
     

    Attached Files:

    Last edited: Mar 30, 2021
  13. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Try resetting the MPImageBasic component if you are still using MPImageBasic in your project.
     
  14. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Thanks for reporting these issues. I have fixed these and they will be available in the next update.
     
    Korindian likes this.
  15. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Thanks, I noticed they're fixed in the latest .99.5 version.

    However, I'm still getting 14 or so "'someVariable' is never used" warnings in the console when installing the latest version. I'm not using the Unity Editor option to "Suppress Common Warnings" as I want to be able to see those warnings for my own code. Can you put some pragmas in for those particular lines if possible?
     
    Carwashh likes this.
  16. nyonge

    nyonge

    Joined:
    Jul 11, 2013
    Posts:
    49
    Hi! Just checking in here, this would be super useful. Is there any way to get an accurate Mouse Over detection for a rounded MPUI image currently?
     
  17. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Sure, I'll do that in the next update.
     
    Korindian likes this.
  18. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Sorry, currently there is no solution for this provided in the package. I have taken this as a feature request and I will try to implement it if possible in a future release.
     
    nyonge likes this.
  19. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi, I'm using 2 MPImageBasic components with a circle shape in a prefab (I'll call it PrefabWithCircles). This prefPrefabWithCircles is then nested inside 2 other prefabs (I'll call them Prefab1 and Prefab2). Every time I set the radius or stroke for both components and save/autosave the PrefabWithCircles, on exiting the prefab editor, the Radius and Stroke get reset to 0. The Falloff value however does get saved.

    If I open either Prefab1 or Prefab2, and try to edit PrefabWithCircles within them, Radius and Stroke values again don't get saved when exiting the prefab editor. If I try applying the overrides on PrefabWithCircles within the context of Prefab1 or Prefab2, Radius and Stroke of PrefabWithCircles immediately gets reset to 0.

    Can you take a look at this please?
     
  20. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    You've got a nifty feature to easily swap between MPImage and MPImageBasic - right mouse click -> replace with. However!
    - this action doesn't get added to the undo stack, so can't be undone.
    - the changes aren't copied over to the replace class.

    When replacing either component with the other, at the bare minimum I expect any assigned sprites and colour changes to be kept, probably keep Preserved Aspect flag how I set it too.
     
  21. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Surely I'll take a look.

    Hi, this is already planned and will be added soon.
     
    Korindian and Carwashh like this.
  22. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    Hey - it's not possible to change the Image Type on multiple selected objects at the same time, the other values work (method/ origin/ amount) but not type. See gif

    I've only tested on MPImage Basic so far
    V5mAPGURID.gif
     
  23. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Thanks for reporting, I will take a look.
     
  24. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey developer! Like in the Gif posted by @Carwashh, I've noticed that I am unable to change values such as uniform radius, outline width, stroke, fall off and whatnot when multi-selecting MPImage Basic. The issue does not occur when multi-selecting the normal MPImage though. Is this intended behaviour?
     
  25. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    I've stopped using MPImageBasic completely, keep having too many issues with it.

    It's a little frustrating that they don't both extend from a common base class too, MPImageBase for example, would make it better for manipulating via code.
     
  26. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131

    Hey @Carwashh! I was just facing this peculiar issue myself. I then proceeded to test it out on a fresh new project and the issue was not reproducible, which was exactly what you were going through as well. Turns out this issue only occurs when the color space is set to linear under project settings. So it appears the outline color for MPImage Basic is not correctly translated in linear color space. Hope the developer will be able to take a look at this!

     
    Last edited: May 27, 2021
    seldemirov likes this.
  27. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    @Klausology excellent, we're using Linear space, so that'll explain it for us too! Thanks very much
     
    Klausology likes this.
  28. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Glad to figure out what was causing the issue! ;)
     
    Last edited: May 28, 2021
  29. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hmm @Carwashh was right. MPImage Basic is riddled with quite a few issues I must say. The corner radius appears to be limited by the rect transform's width when in free mode for some reason. The normal MPImage does not have this issue.
     
  30. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hmm apparently MPImage basic also has some scaling issues. I am changing the scale from 0.5 to 1.5 in an update loop and it does not work properly:


     
  31. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    @Klausology that's the main reason why I switch back to normal
     
    Klausology likes this.
  32. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi there, it's been a couple of months... have you had a chance to look into the nested prefab problem with MPImageBasic?
     
  33. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Ahh indeed. I have also decided to switch back to the normal version. :(
     
  34. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    Click the 'Set Native Size' button changes the RecTransform anchor/position/etc. I expect the image to stay where it is and just the size to change.
     

    Attached Files:

  35. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    This happens even with Unity's built-in UI btw. it has always slightly annoyed me but alas.
     
    Carwashh likes this.
  36. Chaoszerom

    Chaoszerom

    Joined:
    May 24, 2017
    Posts:
    5
    Hi dev, there's an issue with StrokeWidth that I've encountered, not sure if they're from nested prefabs or layout groups. Relevant snippet:

    Code (CSharp):
    1.  
    2.         public float StrokeWidth {
    3.             get => m_StrokeWidth;
    4.             set {
    5.                 Vector2 size = GetPixelAdjustedRect().size;
    6.                 m_StrokeWidth = Mathf.Clamp(value, 0, Mathf.Min(size.x, size.y) * 0.5f);
    7.                 base.SetVerticesDirty();
    8.             }
    9.         }
    10.  
    GetPixelAdjustedRect().size is returning (-6, -6) when the scene is loaded from save, resetting the Stroke Width to 0. I don't know what the fix is, for my case I've just removed the constraint.

    There's also issues with button graphic targets resetting their color, which I'm currently working around by disabling/enabling, but I'm not sure what the cause of that one is. Give me a shout if you want me to try break down that case a bit further
     
  37. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    161
    Hi, GetPixelAdjustedRect() returns (0, 0) at the very first time when scene is loaded. After that, it returns the correct value. Due to the constraint, StrokeWidth gets reset to 0 at the very first. This is the reason why I had to remove the constraints as a feature, and I am trying to get a workaround.

    I did not quite get the issue here. Would you please elaborate a little more?
     
  38. Chaoszerom

    Chaoszerom

    Joined:
    May 24, 2017
    Posts:
    5
    An example is this button. If the "Target Graphic" of the button were a Unity Image, the visible colour would always be the image's colour * the button's Normal Color. However, something happens in the Editor and it ignores the button's contribution sometimes. Disabling and enabling the Button component usually fixes it temporarily.
    upload_2021-7-12_17-44-6.png

    upload_2021-7-12_17-44-46.png

    upload_2021-7-12_17-45-17.png
     
  39. TheDavid8

    TheDavid8

    Joined:
    Nov 19, 2013
    Posts:
    52
    Hello, I just bought
    When I select the image type dropdown, I only get simple and filled, where you get sliced and tiled. How do I get this as well? It appears mp image is up to date I am on .99.5
     
  40. TheDavid8

    TheDavid8

    Joined:
    Nov 19, 2013
    Posts:
    52
    How are we looking for the final release? I also only have one demo scene and I am currently trying to figure out how the text shows and hides along with the image. I will be manually animating in c#.
     
  41. Gigacee

    Gigacee

    Joined:
    Mar 4, 2015
    Posts:
    53
    Hi, while opening Gradient Editor window, the following error messages will be continuously output to the console:

    Code (CSharp):
    1. Assertion failed on expression: 'didInsert'
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Env: Unity 2021.1.15f1, Modern Procedural UI Kit v0.99.5

    upload_2021-7-22_16-25-43.png
     
  42. Gigacee

    Gigacee

    Joined:
    Mar 4, 2015
    Posts:
    53
    Isfaq likes this.
  43. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey developer. I am facing this strange issue where the material refuses to save the changes after pressing cntrl+s in the editor. Attached Gif showing issue:




    Apparently, if I copy and paste the same mpui gameobject enough times, it will stop saving changes made to the material. Notice towards the end of the gif, after i've made changes to the stroke value, and pressed save, the changes are ignored and reverts to its previous values. Hope you'll be able to take a look at this.

    Also, I would like to ask if you've managed to fix the issue with linear vs gamma color space discrepancies? Thank you for helping as always!
     
  44. jasonrbrock

    jasonrbrock

    Joined:
    May 22, 2019
    Posts:
    15
    Hey dev,
    Thanks for the awesome asset :)
    Why does this not change the colour?

    Code (CSharp):
    1.  
    2. public MPImage theMPImage;
    3. // ... stuff
    4. theMPImage.color = new Color32(229, 229, 229, 255);
    5.  
    ?
     
  45. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    upload_2021-8-24_18-57-52.png

    I'm having a problem where gradients so not have accurate colors they're much brighter than they should be which is a huge problem for me :(

    Non-gradients look fine.

    this is in URP

    EDIT: It's not that it can't reach the colors, it's just that the colors i put in don't match the result i have to use completely different colors to make it match the reference.

    The shader color values are correct, but the result is wrong
     
    Last edited: Aug 25, 2021
  46. jasonrbrock

    jasonrbrock

    Joined:
    May 22, 2019
    Posts:
    15
    hey sacb0y, what code are you using for non-gradients?
    scratching my head trying to get a simple solid colour to work using ....
    Code (CSharp):
    1. theMPImage.color = new Color32(229, 229, 229, 255);
     
  47. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    I'm just using the UI at this point, but i don't think you would use Color32 for that.
     
  48. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Fixed the problem the solution is convert from gamma to linear space

    change line 258 in the MPImage.shader to this. This function is native to unity.
    Code (CSharp):
    1. return float4(GammaToLinearSpace(color), alpha);
    upload_2021-8-24_20-37-37.png

    Thanks Why485 for helping me figure this out.
     
    Aniko_V and Carwashh like this.
  49. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Hi there. I am trying to do a pie shape with this asset, and I need precise control over the start and stop arcs, I can SORT of achieve what I want using the filled circle and adjusting the fill amount. This gives me rather crude control over the end angle, but not the start angle. Best I can seem to figure out the only options I have for the start angle are 4 preset locations.

    Am I missing something? Is there a way to achieve this?

    In the attached example image I want the start angle to be the mirror of the end angle. And I need to do similar to the under side.

    Thanks!

    image_2021-09-08_193948.png
     
  50. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Another problem, "stroke" does not save in a prefab, this is quite a problem :/

    EDIT: I don't quite understand the logic of this function but for now i've changed it to a simple clamp

    Code (CSharp):
    1.         public float StrokeWidth {
    2.             get => m_StrokeWidth;
    3.             set {
    4.                 //Vector2 size = GetPixelAdjustedRect().size;
    5.                 //m_StrokeWidth = Mathf.Clamp(value, 0, Mathf.Min(size.x, size.y) * 0.5f);
    6.                 m_StrokeWidth = Mathf.Max(0, value);
    7.                 base.SetVerticesDirty();
    8.             }
    9.         }
    Maybe something in the order of how this is calculated with a prefab causes it to screw up when set.
     
    Last edited: Sep 12, 2021