• Unity
  • Find SkeletonData(s) that are not compatible!

Related Discussions
...

Hi Herald,

How can I find SkeletonData(s) that are incompatible with current runtime? Given that our project has hundreds of SkeletonData(s) scattered all over the project.

Is there like a quick check or report tool for that?

Thank you, Marek.


I guess the function bellow is a good starting point for scanning whole project right? :-)

public static bool CheckForValidSkeletonData (string skeletonJSONPath)
[MenuItem("Foriero/Spine/Check Compatibility", false, 300)] public static void SpineCheckCompatibility() => SpineInternal.CheckAllSpineAssetsForCompatibility();

    static class SpineInternal
    {
        public static void CheckAllSpineAssetsForCompatibility()
        {
            var guids = AssetDatabase.FindAssets("t:TextAsset");                
            foreach(var guid in guids)
            {
                var p = AssetDatabase.GUIDToAssetPath(guid);
                var ta = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
                if(AssetUtility.IsSpineData(ta, out var compatibilityProblem))
                {
                    if (compatibilityProblem != null) Debug.LogError(compatibilityProblem.DescriptionString());
                }
            }                
        }
    }

Sorry for the late reply. Yes, the above code looks very good, the compatibilityProblemInfo out parameter will be non-null in case of a problem.

I would only suggest to add the object reference to the LogError call so that you can click on the console output and jump to the file in the Project panel:

Debug.LogError(compatibilityProblem.DescriptionString(), ta);  // ta reference added