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

Only getting correct behavior on subsequent loops #326

Open
Braza opened this issue Aug 15, 2024 · 3 comments
Open

Only getting correct behavior on subsequent loops #326

Braza opened this issue Aug 15, 2024 · 3 comments
Assignees
Labels
bug Something isn't working need more info

Comments

@Braza
Copy link

Braza commented Aug 15, 2024

Hi! I try to integrate the system for coins rewards. I think what I am doing is pretty basic:

  • added few instances of UIParticles prefabs to the scene to handle different instances of coin bursts. They are children of a separate canvas in overlay mode to control order as needed.
    image
  • each has 2 children of Particle Systems using recommended UI/Default material, masking disabled
    image
  • Particles themselves emit a single Burst. Renderer seem to be disabled by UIParticles
    image

In general it does not emit anything with the code below.
image
Or maybe emit it but like this:
no_looping_ui
but if during the runtime I switch Particle Systems to looping
looping_ui
notice the 1st burst goes wrong, likely in the game space, not UI space

Expected behavior
I'd expect that UIParticles.Play would emit burst particles as configured in the PS.
Also I'd expect that behavior would not depend on iteration number.

Environment (please complete the following information):

  • Version 4.9.1
  • Platform: Editor Windows
  • Unity version: 2022.3.40f1
  • Build options: IL2CPP, .Net 4.x, URP, 2D
@Braza Braza added the bug Something isn't working label Aug 15, 2024
@Braza
Copy link
Author

Braza commented Aug 15, 2024

I got things working by adding SetDirty and RefreshParticles before the Play, also added StartEmission at the end. No idea which item helps, so any suggestions how to make it in a clean way are appreciated. Or we can close this one.

            freeParticleSystem.transform.position = pos;
            freeParticleSystem.SetAllDirty();
            freeParticleSystem.RefreshParticles();
            freeParticleSystem.Play();
            freeParticleSystem.StartEmission();

@mob-sakai
Copy link
Owner

Thank you for your reporting!

@mob-sakai
Copy link
Owner

I would like to know more about this issue.
Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue?
Of course, you don't need to include any secret assets from your project. Feel free to use free assets instead.

repos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need more info
Projects
None yet
Development

No branches or pull requests

2 participants