0 支持
167 閲覧
(870 ポイント) Q&A

SS6PU Version:  v2.2.1

Unity 2020.3 LTS

SS6PU will generate many AnimationClips after import process. 

These AnimationClip files end with suffix ".asset"

I suspect there are some bug of these generated clip because it will enlarge its self greatly if I change the "LoopTime" flag via unity editor.

Could you please help to check this problem?

It bother me greatly because change "Loop" flag manually is my only way to set the loop info ( ss won't save anything info about loop)

And here is the steps:

このページをシェアする

回答 2

0 支持
(870 ポイント)
 
ベストアンサー

Finally, we figure out that this is caused by Unity's mechanism that it will save some editor data to animation clip for editor usage.

Although it won't affect the built game, it still make my version control software(Git) feels uncomfortable, huge amount of data have been added to git history.

So my solution is to write some editor tool to change the data of animation clip directly. For anyone who may need it in the future, my code will be attached below

```  

    private static void SetLoopFlag(bool value, AnimationClip clip)
    {
        if (clip)
        {
            var so = new SerializedObject(clip);
            so.FindProperty("m_AnimationClipSettings.m_LoopTime").boolValue = value;
            so.ApplyModifiedProperties();
 
            //set dirty
            EditorUtility.SetDirty(clip);
        }
    }

```  

0 支持
(4.9k ポイント)

Dear Justus.

This is developer of "SS6Player for Unity" (SS6PU).
I have checked to see if the same kind troubles occur with some of the data I have on hand.
I did not observe any troubles of "AnimationClip" size or content-changing as result of manually changing "Loop Time".
[Checking Unity Version]
  • Unity 2019.4.31f1 (LTS) on Windows10 Pro x64
  • Unity 2020.3.31f1 (LTS) on Windows10 Pro x64
  • Unity 2021.3.22f1 (LTS) on Windows10 Pro x64

Therefore, your trouble is most likely dependent on either  "specific version of Unity" or "data of SpriteStudio".

What is the exact version of Unity?
And ... If possible, Can you please provide us with SpriteStudio data that causes the relevant trouble?
Another support person will follow up with an email or reply here on how to provide the data.
Please consider it.
Best Regards,
(870 ポイント)
編集

I have sent a minimal reproduce project to support email.

this issue both happen in following version in my test

- Unity 2020.3.38 & SS6PU Ver. 2.2.1

- Unity 2021.3.19 & SS6PU Ver. 2.2.1

I have also sent my animation clip files together inside SS project, please check the folder "UnityFileDiff"

In Summary, the issue could be described by following table

VerImport Sizeenable loop Sizem_LoopTimem_ClipBindingConstantm_EditorCurves
Unity 2020.3.38f116kb(498lines)46kb(1806lines)0->1empty->huge[]->huge
Unity 2021.3.19f116kb(497lines)18kb(603lines)0->1empty->huge[]->[]

Steps to Reproduce:

1. create a new blank unity project

2. install SS6PU v2.2.1

3. import ss project LoopFlagIssue.sspj via Unity-Native mode

4. check the generated animation clip "ac_Main_Idle.asset", it's about 498 or 497 lines.

5. enable "LoopTime" check box via Unity inspector, then press Ctrl+S to save Unity project(necessary step)
6. check "ac_Main_Idle.asset" again, huge amount of lines under m_ClipBindingConstant & m_EditorCurves have be generated. this is a bug. The expected behavior should be that only m_LoopTime line being changed and no size enlarging happen. 

(870 ポイント)

new info:

it seems that m_EditorCurves will be added if animation window is open when change save the changed clip.

if animation windows is closed it seems could avoid it.

But I don't know what m_ClipBindingConstant.genericBindings  is, this part will always increase, is it some necessary info which just omit by the SS6PU? or it's also unnecessary data?

(4.9k ポイント)
編集

Dear Justus.

This is "SS6Player for Unity" developer.

Oh ...... I see.

When you manipulate AnimationClip with "Animation"-window open, file-size will basically increase.

This is unavoidable behavior (as Unity's specification).

Also, there is no way to control this behavior on "SS6Player for Unity" side.

Increased informations are mainly auxiliary information for use on Unity Editor, such as "m_EditorCurves".

However, increased informations will be removed when project is built, and data will be reduced to the bare minimum.

As a general rule, do not judge the size of "AnimationClip" or other assets by the size of asset-file.

The size of "AnimationClip" data is output as information in inspector.

Best Regards, 

(870 ポイント)
編集

I see. 

Finally I created a custom unity plugin to change the Loop flag of AnimationClip directly without adding any other editor data.

But I think there is another way could improve this workflow greatly.

1) the reason I have to change Loop manually is that SS has no "loop" concept of an animation.
2) but Unity-Native Mode could have this concept, because it generates AnimationClip which contains this property

3) my request is to add a feature to Unity-Native Mode which allow us indicate a Regular Expression to match the animation name of SS project, if any animation match successfully, the generated animation clip will set loop to true by default.

For example, I add "loop$" means and animation whose name end with "loop" should be regarded as matched.

".*-move-.*" means if the name contains "-move-" string, it matched.

This is just a proposal. Just for your information.

I have used another animation importer which could convert Aseprite(a pixel art painting software) project to Unity native animation clips. And it use similar way I mentioned above to indicate loop status. here is the snapshot:

 

(4.9k ポイント)
編集
Dear Justus.

This is developer of "SS6Player for Unity" (SS6PU).

Thanks for yout advice.
I will use your advice as a reference for update future.

However, currently in "SS6PU", I cannot immediately say "Yes." to the inclusion of expansion requests that are biased toward the use of each individual user.
And I also cannot promise to implement the content of your advice in the future.

SS6PU is released as "Open Source Software" so that each user can add their own special specifications locally as wish.
Especially in "Convert To Unity-Native" mode, animation data is converted to AnimationClip, so there is a wide range of usage,controlling and management methods for each user.

Currently, I am avoiding the idea of standardizing implementation of some of specific application biased features that you have pointed out.

Therefore, I recommend that you first maintain the current proposal as your own customization.

I appreciate your understanding.

Finally, again, thank you for your advice.

Best Regards,
...