Skip to content

[FormerlySerializedAs] attribute for ShaderLab in Unity.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

shaderqu/FormerlySerializedAsForShaderLab

Repository files navigation

FormerlySerializedAs For ShaderLab

blog post : https://seonghwan.tistory.com/122

Features

[FormerlySerializedAs()] for shader

This attribute in shader file will be a rule to re-serialize your materials that uses the shader. It will read the values from the filesystem in *.mat, and put the values at the property of the new name.

Example

Shader "Custom/UI/Default"
{
    Properties
    {
        [FormerlySerializedAs(_PrevValue)] _ChangedValue ("Changed Value", Float) = 0
        ...
    }
    ...
}

image

[FormerlySerializedAs(OLD_NAME)] property can specify what you want to re-serialize the materials on postprocess timing from the callback ' AssetPostprocessor'. This works likes FormerlySerializedAs in MonoScript API.

TODO

  • Replacement tool
  • Clean up unused property against binded shader.

Install

hosted by npm.js

{
    "dependencies": {
        "kr.seonghwan.shader-almighty": "0.0.3"
    }
}
{
    "scopedRegistries": [
        {
            "name": "npm-seonghwan",
            "url": "https://registry.npmjs.org",
            "scopes": [
                "kr.seonghwan",
                "aaubry"
            ]
        }
    ]
}

Dependencies