• Unity
  • How to force update SkeletonGraphic after change its color?

  • Изменено
Related Discussions
...

I know SkeletonGraphic's color is controlled by SkeletonGraphic.color
what I need is change it's alpha to 0, and should show result at that frame
and I tried these method below, but it seem not work, still only change at next frame

Unity: 2019.2.2, Runtime: 3.8


skeletonGraphic.color = new Color(1, 1, 1, 0);
skeletonGraphic.Rebuild(UnityEngine.UI.CanvasUpdate.PreRender);
skeletonGraphic.Update();
skeletonGraphic.UpdateMesh();
skeletonGraphic.LateUpdate();
skeletonGraphic.Update(0);
skeletonGraphic.Skeleton.Update(0);

don't know how to correctly do this

I'm afraid I don't know either, but I've forwarded this thread to Harri our Unity wizard to reply to you when he's back from vacation next week.

I have do a clean scene and a simple script to test this
the actual situation is that I'm extending the Fungus plugins command
it use Start() and call a coroutine, and then without hit any yield to my code
this logic normally should make the spine's alpha to be 0 as I want
but not happened in this third party plugin, don't know how it delayed rendering

for solving this problem, what I want is just directly set alpha at start
in this purpose I use another method not depending on command to solve it

Glad you figured it out. It is indeed strange that your plugin does not execute your code as expected. In general, even just calling skeletonGraphic.color = new Color(1, 1, 1, 0); would be sufficient to change the color in the same frame.