Skip to content

[Feature Request]: Add support for shaders and material editor #358

@spark-farahani-ahmad

Description

@spark-farahani-ahmad

This is probably going to be a huge time investment but since unity material editor is hugely lacking and requires custom editor for almost any kind of useful functionality, supporting shaders and material editor would have a huge impact for users IMHO.

By material/shader support I mean creating a custom editor for Material type and add support for useful attributes inside a shader properties block. You can do this through a custom shader GUI class to keep the functionality of existing shaders.

MaterialEditor already has support for attributes (drawers and decorators), but the implementation is very naive and has lots of limitations (check MaterialEditor.GetShaderPropertyHandler()). You can get array of strings of shader propertiy attributes (includingattribute arguments) using Shader.GetPropertyAttributes() and from there make your own implementation of the shader attribute system. You might want to check MaterialPropertyHandler to see how unity handles attributes internally.

Attributes I'd like to have:

  • Saints UI attributes ->
    • Layout
    • Hideif/showif/enableif/disableif
      • Support for checking if a texture property is assigned or not (e.g. showIfAssigned("SomeTexture"))
      • Support for checking keywords (e.g. showIfKeyword("_SOME_KEYWORD"))
    • InfoBoxes
    • RichLabel
  • Inline (drawing texture properties inline, see MaterialEditor.TexturePropertySingleLine() and MaterialEditor.TexturePropertyTwoLines())
  • Indent/Outdent
  • Auto assign keywords based on properties
    • Enable/disable keywords based on a texture property being assigned or not
  • Vector2/Vector3 support (UI only. Material system uses vector4 always)
  • Tooltip support
  • Min/Max attributes (Maybe with vector support)
  • Min-Max slider for Vector type
  • FormerlySerializedAs attribute. This is extremely useful yet not supported by unity.

※Some of these would probably need a custom material post processor (something like URP material post processor) or even a build preprocessor to work correctly, but all of them should be doable.

Implementing this is not going to be easy but I think will definitely be worth the time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions