mob-sakai / ParticleEffectForUGUI

Render particle effect in UnityUI(uGUI). Maskable, sortable, and no extra Camera/RenderTexture/Canvas.
MIT License
4.22k stars 616 forks source link

New drawcall added, cannot be batched #320

Open nomedy opened 1 month ago

nomedy commented 1 month ago

There is a particle using UIParticle between the two pictures. The three components do not block each other. The two pictures use the same atlas. Why are there three DrawCalls displayed in the FrameDebug panel?

VideoLobby - app_goldslots_unity_ios - iOS - Unity 2019 4 36f1  PREVIEW PACKAGES IN USE   Metal  Unity, Today at 18 36 38 VideoLobby - app_goldslots_unity_ios - iOS - Unity 2019 4 36f1  PREVIEW PACKAGES IN USE   Metal  Unity, Today at 18 36 42
mob-sakai commented 1 month ago

Thank you for your reporting! Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue?

repos

mob-sakai commented 1 month ago

@nomedy Is Sprite Atlas enabled in the editor?

nomedy commented 1 month ago

I have of course activated "Always Enabled" for Sprite Packer. The demo shows that there are still three drawcalls. particleDemo.zip

pic
mob-sakai commented 1 month ago

@nomedy Try latest version

nomedy commented 1 month ago

When I upgraded to the latest version, the IgnoreCanvasScaler variable in the UIParticle class disappeared. What should I do if it did the scaling in Transform when it was not checked originally? @mob-sakai

mob-sakai commented 1 month ago

Oh, sure... I had missed that case.

nomedy commented 1 month ago

I need to update to the latest version urgently. How long will it take to fix this problem?

mob-sakai commented 1 month ago

Perhaps the work needed is UIParicle.autoScalingMode=None

mob-sakai commented 1 month ago

Or try using a package with the default value of AutoScalingMode changed to None. com.coffee.ui-particle-4.9.0.tgz

https://github.com/mob-sakai/ParticleEffectForUGUI/blob/main/Runtime/UIParticle.cs#L108

private AutoScalingMode m_AutoScalingMode = AutoScalingMode.Transform;
->
private AutoScalingMode m_AutoScalingMode = AutoScalingMode.None;

Install a UPM package from a local tarball file

mob-sakai commented 1 month ago

@nomedy

nomedy commented 1 month ago

It is not an ideal solution. There will be many changes. Different particles may have different properties.

mob-sakai commented 1 month ago

Does AutoScalingMode= None fix your problem?

nomedy commented 1 month ago

This method can certainly solve the problem, but it is troublesome to deal with our projects one by one.