Lost Material.mainTexture if using AnimatableProperties.
wallstudio opened this issue ยท 2 comments
Describe the bug
Lost Material.mainTexture if using AnimatableProperties.
To Reproduce
Steps to reproduce the behavior:
- Create a ParticleSystem. (Default: mapped Circle texture)
- Attach a UIParticle.
- Enable any animatable properties. (not bind mainTexture).
- See particle. Lost texture mapping.
Expected behavior
A Material that presented a canvas is inherit a texture of original material (that bind mainTexture
).
Environment (please complete the following information):
- Version: v4.6.3
- Platform: Windows
- Unity version: 2023.2.7f1
- Build options: In Editor
- Project for reproducing: BugProject_UIParticle.zip
Additional context
// ModifiedMaterial class
// https://github.com/mob-sakai/ParticleEffectForUGUI/blob/6d8dee0/Runtime/ModifiedMaterial.cs#L28-L33
customMat = new Material(baseMat)
{
name = $"{baseMat.name}_{id}",
hideFlags = HideFlags.DontSave | HideFlags.NotEditable,
mainTexture = texture ? texture : null
}
The UIParticle presents a copy material to a canvas, if enabled animatable properties. (at ModifiredMaterial class) That time, it uses UIParticleRenderer.mainTexture
that is a atlas of TextureAnimationSheet. If it dose not have the TextureAnimationSheet, mainTexture
is null. The material copying process is overrides mainTexture
of the material after copy by Material constructor. So, it override mainTexture
by null.
When Old version, NOP if the ParticleSystem dose not have a TextureAnimationSheet.
// Old ModifiedMaterial class
// https://github.com/mob-sakai/ParticleEffectForUGUI/blob/3.3.14/Scripts/ModifiedMaterial.cs#L28-L29
e.customMat = new Material(baseMat);
e.customMat.hideFlags = HideFlags.HideAndDontSave;
if (texture)
e.customMat.mainTexture = texture;
I suggest revert this copy process.
๐ This issue has been resolved in version 4.6.4 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐
๐ This issue has been resolved in version 4.6.4 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐