{"record":{"id":"93c472a9c51ed63c","repo":"egametang/ET","slug":"self-motiontype-93c472","errorCode":null,"errorMessage":"动作播放失败: {self.MotionType}","messagePattern":"动作播放失败: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.mapplay/Scripts/HotfixView/Client/Unit/AnimatorComponentSystem.cs","lineNumber":71,"sourceCode":"\t\t\t}\n\n\t\t\tif (self.MotionType == MotionType.None)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tself.Animator.SetFloat(\"MotionSpeed\", self.MontionSpeed);\n\n\t\t\t\tself.Animator.SetTrigger(self.MotionType.ToString());\n\n\t\t\t\tself.MontionSpeed = 1;\n\t\t\t\tself.MotionType = MotionType.None;\n\t\t\t}\n\t\t\tcatch (Exception ex)\n\t\t\t{\n\t\t\t\tthrow new Exception($\"动作播放失败: {self.MotionType}\", ex);\n\t\t\t}\n\t\t}\n\n\t\tpublic static bool HasParameter(this AnimatorComponent self, string parameter)\n\t\t{\n\t\t\treturn self.Parameter.Contains(parameter);\n\t\t}\n\n\t\tpublic static void PlayInTime(this AnimatorComponent self, MotionType motionType, float time)\n\t\t{\n\t\t\tAnimationClip animationClip;\n\t\t\tif (!self.animationClips.TryGetValue(motionType.ToString(), out animationClip))\n\t\t\t{\n\t\t\t\tthrow new Exception($\"找不到该动作: {motionType}\");\n\t\t\t}\n\n\t\t\tfloat motionSpeed = animationClip.length / time;\n\t\t\tif (motionSpeed < 0.01f || motionSpeed > 1000f)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.mapplay/Scripts/HotfixView/Client/Unit/AnimatorComponentSystem.cs#L53-L89","documentation":"Thrown by AnimatorComponentSystem (mapplay package) when calling Unity's Animator.SetTrigger or Animator.SetFloat fails inside a try-catch. The trigger name is self.MotionType.ToString(), so the most common cause is that the AnimatorController does not have a trigger parameter matching the MotionType enum name. The inner exception is preserved. This is a near-identical duplicate of the lockstep LSAnimatorComponent implementation.","triggerScenarios":"PlayInTime or a direct animation call sets self.MotionType to a value whose ToString() does not correspond to any trigger parameter in the AnimatorController asset. Or the Animator component is null/destroyed at call time.","commonSituations":"A new MotionType enum value was added but the AnimatorController asset was not updated with the matching trigger. AnimatorController was swapped or missing from the prefab. Animator component was not assigned or was destroyed before the call.","solutions":["Open the AnimatorController asset and add a trigger parameter named exactly after the MotionType enum value shown in the error.","Ensure the Animator component is assigned and active on the GameObject at call time.","Check HasParameter(motionType.ToString()) before calling SetTrigger to guard against unconfigured states."],"exampleFix":"// before\nself.Animator.SetTrigger(self.MotionType.ToString());\n// after: guard with HasParameter\nstring triggerName = self.MotionType.ToString();\nif (self.HasParameter(triggerName))\n{\n    self.Animator.SetTrigger(triggerName);\n}\nelse\n{\n    Log.Warning($\"Animator missing trigger: {triggerName}\");\n}","handlingStrategy":"validation","validationCode":"// Guard before triggering animation\nstring triggerName = self.MotionType.ToString();\nif (self.Animator == null) { Log.Error(\"Animator is null\"); return; }\nif (!self.HasParameter(triggerName)) { Log.Warning($\"Animator missing trigger: {triggerName}\"); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep MotionType enum values and AnimatorController trigger names in sync.","Use HasParameter() as a guard before any SetTrigger/SetFloat call.","Validate AnimatorController assets in a build pre-check to catch missing parameters early."],"tags":["animation","animator","mapplay","unity"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}