Skip to content

Unity 6.2 以降で ShaderUtil の一部のメンバーが Obsolete 警告を出すのに対応 - #2811

Merged
ousttrue merged 2 commits into
vrm-c:masterfrom
saturday06:fix-unity-6.1-shader-util-warnings
Jul 6, 2026
Merged

ousttrue merged 2 commits into
vrm-c:masterfrom
saturday06:fix-unity-6.1-shader-util-warnings

Conversation

@saturday06

@saturday06 saturday06 commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Unity 6.2 以降で、UniVRMが利用している ShaderUtil の次のメンバーが Obsolete となり警告が出るようになりました。

これらは Shader インスタンスのメソッドと UnityEngine.Rendering.ShaderPropertyType に置き換わりました。これらの置き換え先として警告メッセージで指定されている項目は全て UniVRM の最小サポートバージョンである Unity 2022.3 LTS にも存在するため、そのまま置き換えました。

発生していた警告は次のようなものでした。

Packages\VRM10\Runtime\Components\Expression\Preview\PreviewMaterialUtil.cs(19,33): warning CS0618: 'ShaderUtil.GetPropertyCount(Shader)' is obsolete: 'Use Shader.GetPropertyCount instead.'
Packages\VRM10\Runtime\Components\Expression\Preview\PreviewMaterialUtil.cs(21,32): warning CS0618: 'ShaderUtil.GetPropertyType(Shader, int)' is obsolete: 'Use Shader.GetPropertyType instead.'
Packages\VRM10\Runtime\Components\Expression\Preview\PreviewMaterialUtil.cs(22,28): warning CS0618: 'ShaderUtil.GetPropertyName(Shader, int)' is obsolete: 'Use Shader.GetPropertyName instead.'

Unity 6.2 以降で、UniVRMが利用している ShaderUtil の次のメンバーが Obsolete となり警告が出るようになりました。

- [GetPropertyCount](https://docs.unity3d.com/6000.2/Documentation/ScriptReference/ShaderUtil.GetPropertyCount.html)
- [GetPropertyType](https://docs.unity3d.com/6000.2/Documentation/ScriptReference/ShaderUtil.GetPropertyType.html)
- [GetPropertyName](https://docs.unity3d.com/6000.2/Documentation/ScriptReference/ShaderUtil.GetPropertyName.html)
- [ShaderPropertyType](https://docs.unity3d.com/6000.2/Documentation/ScriptReference/ShaderUtil.ShaderPropertyType.html)

これらは `Shader` インスタンスのメソッドと `UnityEngine.Rendering.ShaderPropertyType` に置き換わりました。これらの置き換え後の項目は全て UniVRM の最小サポートバージョンである Unity 2022.3 LTS にも存在するため、そのまま置き換えました。

発生していた警告は次のようなものでした。

```
Packages\VRM10\Runtime\Components\Expression\Preview\PreviewMaterialUtil.cs(19,33): warning CS0618: 'ShaderUtil.GetPropertyCount(Shader)' is obsolete: 'Use Shader.GetPropertyCount instead.'
Packages\VRM10\Runtime\Components\Expression\Preview\PreviewMaterialUtil.cs(21,32): warning CS0618: 'ShaderUtil.GetPropertyType(Shader, int)' is obsolete: 'Use Shader.GetPropertyType instead.'
Packages\VRM10\Runtime\Components\Expression\Preview\PreviewMaterialUtil.cs(22,28): warning CS0618: 'ShaderUtil.GetPropertyName(Shader, int)' is obsolete: 'Use Shader.GetPropertyName instead.'
```

@ousttrue ousttrue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
UnityEditor.ShaderUtil.ShaderPropertyType to UnityEngine.Rendering.ShaderPropertyType

https://docs.unity3d.com/6000.2/Documentation/ScriptReference/ShaderUtil.ShaderPropertyType.html

@ousttrue
ousttrue merged commit 1e7976e into vrm-c:master Jul 6, 2026
1 check passed
@ousttrue ousttrue mentioned this pull request Jul 8, 2026
@saturday06
saturday06 deleted the fix-unity-6.1-shader-util-warnings branch July 16, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants