Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lost Material.mainTexture if using AnimatableProperties. #311

Closed
wallstudio opened this issue May 21, 2024 · 2 comments
Closed

Lost Material.mainTexture if using AnimatableProperties. #311

wallstudio opened this issue May 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working released

Comments

@wallstudio
Copy link

wallstudio commented May 21, 2024

Describe the bug
Lost Material.mainTexture if using AnimatableProperties.

To Reproduce
Steps to reproduce the behavior:

  1. Create a ParticleSystem. (Default: mapped Circle texture)
  2. Attach a UIParticle.
  3. Enable any animatable properties. (not bind mainTexture).
  4. See particle. Lost texture mapping.

Expected behavior
A Material that presented a canvas is inherit a texture of original material (that bind mainTexture).

Screenshots
image

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.

@wallstudio wallstudio added the bug Something isn't working label May 21, 2024
github-actions bot pushed a commit that referenced this issue May 22, 2024
## [4.6.4](v4.6.3...v4.6.4) (2024-05-22)

### Bug Fixes

* assertion failed on expression: 'ps->array_size()' ([1b5c359](1b5c359)), closes [#278](#278)
* lost Material.mainTexture when using AnimatableProperties ([ea04352](ea04352)), closes [#311](#311)
* remove unnecessary code ([c37c014](c37c014))
Copy link

🎉 This issue has been resolved in version 4.6.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this issue May 22, 2024
## [4.6.4](v4.6.3...v4.6.4) (2024-05-22)

### Bug Fixes

* assertion failed on expression: 'ps->array_size()' ([1b5c359](1b5c359)), closes [#278](#278)
* lost Material.mainTexture when using AnimatableProperties ([ea04352](ea04352)), closes [#311](#311)
* remove unnecessary code ([c37c014](c37c014))
Copy link

🎉 This issue has been resolved in version 4.6.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this issue May 22, 2024
## [4.6.4](v4.6.3...v4.6.4) (2024-05-22)

### Bug Fixes

* assertion failed on expression: 'ps->array_size()' ([1b5c359](1b5c359)), closes [#278](#278)
* lost Material.mainTexture when using AnimatableProperties ([ea04352](ea04352)), closes [#311](#311)
* remove unnecessary code ([c37c014](c37c014))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants