Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Unity UI big problem with lacking materialpropertyblock for ui image

Discussion in 'UGUI & TextMesh Pro' started by mahdiii, Nov 30, 2017.

  1. JoeysLucky22

    JoeysLucky22

    Joined:
    May 11, 2013
    Posts:
    15
  2. unity_2CA76F7135DB5C81503B

    unity_2CA76F7135DB5C81503B

    Joined:
    Nov 17, 2021
    Posts:
    1
  3. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
  4. JeroenTekle

    JeroenTekle

    Joined:
    Jun 1, 2021
    Posts:
    4
  5. mortoray

    mortoray

    Joined:
    Sep 14, 2018
    Posts:
    94
    It's sad that this isn't supported. I came back to UGUI after trying UI Toolkit, where it appears the restrictions are even more severe on what can be done.

    I'm starting to understand why games written in Unity have weak UIs. It's too hard to achieve basic UI feedback effects, MPBs being one way they could be achieved.
     
    Unifikation likes this.
  6. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    457
    Disappointing Unity Technologies does nothing to solve this problem developers face for YEARS.
     
    DaveAstator and Unifikation like this.
  7. altair2020

    altair2020

    Joined:
    Mar 6, 2011
    Posts:
    49
  8. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    457
    Wow, incredibly rude name calling and shilling some unofficial 3rd party package. On top of that, you didn't provide any evidence that what you're linking to could even provide ability to utilize the URP SRP Batcher in the UI to batch custom materials in the UI nor with the builtin RP.
     
    comealong and Unifikation like this.
  9. altair2020

    altair2020

    Joined:
    Mar 6, 2011
    Posts:
    49
    Lol hey Bladder I never even noticed - this is your name now. it’s not 3rd party. I’m pretty sure this resolves the issue. Thanks
     
  10. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,122
    which issue, and how does it resolve it?

    I'm pretty sure you're misunderstanding the issue and the nature of the repo you've linked.
     
  11. altair2020

    altair2020

    Joined:
    Mar 6, 2011
    Posts:
    49
    Maybe, I’ve been subscribed to this thread Forever. Hope you find a solution!
     
  12. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,122
    Here's hoping you know the issue at the core of the thread you've been subscribed to Forever.
     
  13. nickeltin

    nickeltin

    Joined:
    May 5, 2019
    Posts:
    2
  14. Duong216

    Duong216

    Joined:
    Nov 21, 2021
    Posts:
    3
     
    Glader and dvdfu like this.
  15. ihgyug

    ihgyug

    Joined:
    Aug 5, 2017
    Posts:
    194
  16. dvdfu

    dvdfu

    Joined:
    Sep 1, 2015
    Posts:
    11
     
    spider853 and Glader like this.
  17. lgarczyn

    lgarczyn

    Joined:
    Nov 23, 2014
    Posts:
    68
    gigazelle and baptistee like this.
  18. eclipse130300

    eclipse130300

    Joined:
    Dec 6, 2019
    Posts:
    36
  19. Corpvs

    Corpvs

    Joined:
    Nov 27, 2021
    Posts:
    2
  20. aaronggggg

    aaronggggg

    Joined:
    Jan 22, 2015
    Posts:
    1
  21. lgarczyn

    lgarczyn

    Joined:
    Nov 23, 2014
    Posts:
    68
    gigazelle and baptistee like this.
  22. FrankLee_legou

    FrankLee_legou

    Joined:
    Oct 26, 2022
    Posts:
    1
  23. twankm

    twankm

    Joined:
    May 21, 2021
    Posts:
    1
    anyone read this thread in 2023?
     
  24. FoodFish_

    FoodFish_

    Joined:
    May 3, 2018
    Posts:
    58
  25. FoodFish_

    FoodFish_

    Joined:
    May 3, 2018
    Posts:
    58
    Unity Technologies, at least can you teach us how to accomplish this in the new UI Toolkit system?
     
  26. Avelblood

    Avelblood

    Joined:
    May 5, 2016
    Posts:
    6
    As of 2023, there is still no MPB for Image. Holy cow.
     
  27. unity_994A73913883E8176723

    unity_994A73913883E8176723

    Joined:
    May 31, 2022
    Posts:
    4
  28. poomwarning

    poomwarning

    Joined:
    Apr 5, 2020
    Posts:
    2
    baptistee and jamespaterson like this.
  29. zephybite0

    zephybite0

    Joined:
    Apr 25, 2018
    Posts:
    30
  30. raphael_kox

    raphael_kox

    Joined:
    May 1, 2019
    Posts:
    3
  31. Master_Davicous

    Master_Davicous

    Joined:
    Apr 29, 2016
    Posts:
    11
  32. Master_Davicous

    Master_Davicous

    Joined:
    Apr 29, 2016
    Posts:
    11
    I know it's not exactly material property blocks for UI, but if your goal is to have a UI material instance which does not effect the original material, here is the solution for that:

    Simply create a new material instance from the image material, then set the image's material to the new instance:

    Material mat = Instantiate(image.material);
    image.material = mat;
    mat.SetInt("_Property", 0);
     
  33. EgoJacky

    EgoJacky

    Joined:
    Aug 15, 2017
    Posts:
    28
  34. lgarczyn

    lgarczyn

    Joined:
    Nov 23, 2014
    Posts:
    68
    There's also some upcoming updates that makes it MUCH lighter on memory. If anyone wants to add features it would be nice to have some help.
     
  35. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,122
    Sadly, I don't know anything about Editor editing and coding, and am winding down my usage of Unity... due to unforeseen circumstances (Unity's new ToS and Runtime Fee)... but if you want/need any testing help, I'm yours.
     
  36. LuckyZZZZ

    LuckyZZZZ

    Joined:
    Jul 19, 2015
    Posts:
    1
  37. uurha

    uurha

    Joined:
    Nov 15, 2020
    Posts:
    21
  38. lgarczyn

    lgarczyn

    Joined:
    Nov 23, 2014
    Posts:
    68
    Working on a new version that supports the full MaterialEditor feature set, I think some testing will definitely be needed :)
     
    Unifikation likes this.
  39. akasabutski

    akasabutski

    Joined:
    Nov 7, 2018
    Posts:
    12
    Ran into this today. Not surprised by Unity's lack of action.
     
  40. wechat_os_Qy00U6uI1Z4M_7yqi2fXjzxbM

    wechat_os_Qy00U6uI1Z4M_7yqi2fXjzxbM

    Joined:
    Dec 4, 2023
    Posts:
    2
  41. F4bs

    F4bs

    Joined:
    Apr 23, 2019
    Posts:
    19
  42. yyf1990cs

    yyf1990cs

    Joined:
    Sep 28, 2017
    Posts:
    1
  43. voodo120

    voodo120

    Joined:
    May 16, 2019
    Posts:
    1
  44. wechat_os_Qy0w40hyNr_Hd8-tI7UcOsuKM

    wechat_os_Qy0w40hyNr_Hd8-tI7UcOsuKM

    Joined:
    Dec 2, 2020
    Posts:
    4
    Additional Shader Channels
    You Save My Day! Thank for your share
     
  45. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,363
    This old post answers the question I had - Changing color through vertex colors seems incredibly inefficient. Imagine you have a mesh with 10s or 100s of vertices, not simple rectangles. It honestly makes no sense, particularly with the VertexHelper code which is an inefficient way to update the core mesh as well!!

    I did hack my way around this issue with a custom graphic component to update the material instead of the mesh on color change, but this is still not optimal I imagine, you have to cache materials by color to avoid bad batch counts.

    Edit: But I had no idea about IMaterialModifier. I still do not know how it works underneath, does it avoid adding to batch counts?
     
    Last edited: Feb 29, 2024
  46. EnixionSAS

    EnixionSAS

    Joined:
    May 3, 2014
    Posts:
    1
  47. DaveAstator

    DaveAstator

    Joined:
    Jul 27, 2017
    Posts:
    4
  48. EnduvoJD

    EnduvoJD

    Joined:
    Aug 12, 2016
    Posts:
    54
  49. francisIsFine

    francisIsFine

    Joined:
    Jun 26, 2018
    Posts:
    41
  50. MadnessLuca

    MadnessLuca

    Joined:
    Jun 12, 2013
    Posts:
    9
    I just now hit this roadblock, while creating a custom UI element/shader.

    Almost 7 years since this issue was brought up.
    And we are not even worthy of a statement, if this ever gets added.
    Basically sums up my experience with Unity and it's willingness to listen to it's community...

    Welp I guess the only solution for now is to create a new material for every UI element...
     
    Unifikation likes this.