zeuxgame

I'am making an animation selector for our project
To make the window can play animation and previewed, I copied some logic from SkeletonDataAssetInspector, but as the EditorWindow has no preview function by Unity, when I directly call preview.handleInteractivePrrviewGUI, It not update correctly, and It only change pose 1 frame after switch outside Unity and back to focus Unity window, very weired

do anyone can explain how to do this right?
zeuxgame
  • Posts: 27

Harald

Do you mean that you receive only a single update instead of e.g. 30 updates per second, and that the skeleton is therefore not moving? Or did I misunderstand your question?
User avatar
Harald

Harri
  • Posts: 1232

zeuxgame

Camera in preview seems keep updating, but skeleton doesn't, switch between outta window and Unity make it jump to one frame of the animation playing
zeuxgame
  • Posts: 27

Harald

Did you register any update call at EditorApplication.update? E.g. as the following line in the SkeletonDataAsset inspector code:
spine-runtimes/SkeletonDataAssetInspector.cs at 3.8
User avatar
Harald

Harri
  • Posts: 1232

zeuxgame

yes, I tried create SkeletonDataAssetInspector Editor then call OnEnable manually, it contains that

Btw, we use 3.7 and 2018.3
zeuxgame
  • Posts: 27

Harald

You should not create a SkeletonDataAssetInspector editor window instance. What I meant above is that you should be executing similar code in your own class.
User avatar
Harald

Harri
  • Posts: 1232

zeuxgame

After few days, now I copied most SkeletonDataAssetInspector code to my EditoWindow, but since method like OnInteractivePreviewGUI is not handled by EditorWindow self, so I called it in OnGUI manually, but it still not working, the preview seems keep updating but skeleton dose not
zeuxgame
  • Posts: 27

Harald

Sorry to hear that. How do you draw the skeleton? Is this view repainting at all if you place anything else in it?
User avatar
Harald

Harri
  • Posts: 1232

zeuxgame

Sorry for late reply
I have took the script out, and make a small project for showing this problem

here's the step to reproduce it
1.Select Test>Open in toolbar, open the wizard
2.Select any SkeletonDataAsset asset and hit Open
3.Play any animation, preview should be not updating animation
4.Try switching window in and out Unity, it will update to specific frame weirdly
(Video also shows the steps)

https://drive.google.com/file/d/1LvL0OW9P9Tr6zXCUBt58DWzLFWgQQcxc/view?usp=sharing

thanks

(Runtime: Spine 3.7, Unity: 2018.4)
zeuxgame
  • Posts: 27

Harald

Thanks for the assets, I can now reproduce your problem.

What I noticed is that it's also repainting correctly when resizing the window. It seems to be related to special behaviour or requirements of the PreviewRenderUtility. I just found this video where someone successfully used PreviewRenderUtility in an EditorWindow however, repainting every frame:
Custom Unity Inspector Mesh Renderer - YouTube
Please let me know if you find anything helpful in it that solves your problem.
User avatar
Harald

Harri
  • Posts: 1232


Return to Unity