mob-sakai / UIEffect

UIEffect is an effect component for uGUI element in Unity. Let's decorate your UI with effects!
https://github.com/mob-sakai/UIEffect
MIT License
5.62k stars 773 forks source link

EffectPlayer Update at Nx speed (N=The total number of canvases) #191

Open karsion opened 4 years ago

karsion commented 4 years ago

Describe the bug

  1. static List s_UpdateActions; Normal initialization once
  2. There are "n" canvases in the current scene
  3. Canvas.willRenderCanvases is called "n" times

To Reproduce Steps to reproduce the behavior:

  1. Put "10" canvases in the current scene
  2. And then look at the effect

Environment (please complete the following information):

Additional context Add any other context, screenshots or gif animations about the bug here.

BUG Fix

  1. Add “bool isRendered” variable on EffectPlayer
  2. Using “bool isRendered” exclude multiple calls when "void OnWillRenderCanvases()" is called eg:

        void OnWillRenderCanvases()
        {
            if (!play || !Application.isPlaying || _callback == null || isRendered)
            {
                return;
            }
    
            isRendered = true;
            //Timer update...
        }
  3. Add "internal void LateUpdate() { isRendered = false; }" on EffectPlayer
  4. Call on UIEffectComponent eg:
        protected override void LateUpdate()
        {
            base.LateUpdate();
            _player.LateUpdate();
        }
mob-sakai commented 4 years ago

Hi @karsion

Thank you for your reporting!