Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by MLN-lab · Nov 24, 2019 at 06:54 PM · animatorbugbug-perhapsavatar

AvatarBuilder.BuildHumanAvatar set NaN positions with some avatars

I was trying to develop an avatar scaling script. In order to scale the arm length and to have them working with inverse kinematics, I had to update the avatar description. I did it, and it was working properly on my first avatar. However, when I wanted to use the same script on other avatars many error appeared:

  • List item

  • Invalid AABB aabb

  • Expanding invalid MinMaxAABB

  • Assertion failed on expression: 'IsFinite(d)'

  • ...

Here is a sample of the log file:

 - Completed reload, in  0.993 seconds
 Platform modules already initialized, skipping
 Loaded scene 'Temp/__Backupscenes/0.backup'
     Deserialize:            18.835 ms
     Integration:            24.129 ms
     Integration of assets:  0.125 ms
     Thread Wait Time:       18.762 ms
     Total Operation Time:   61.853 ms
 Rescale Avatar
 UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
 UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
 UnityEngine.Logger:Log(LogType, Object)
 UnityEngine.Debug:Log(Object)
 AvatarScaling:LateUpdate() (at Assets\Scripts\AvatarScaling.cs:109)
  
 (Filename: Assets/Scripts/AvatarScaling.cs Line: 109)
 
 [Move To TPose]:    Bone not found:FemaleAndroidBasic(Clone)
 UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
 UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
 UnityEngine.Logger:Log(LogType, Object)
 UnityEngine.Debug:Log(Object)
 AvatarScaling:MoveToTPose() (at Assets\Scripts\AvatarScaling.cs:246)
 AvatarScaling:BuildScaledHumanDescription(Avatar) (at Assets\Scripts\AvatarScaling.cs:170)
 AvatarScaling:LateUpdate() (at Assets\Scripts\AvatarScaling.cs:132)
  
 (Filename: Assets/Scripts/AvatarScaling.cs Line: 246)
 
 FemaleAndroidBasic(Clone) not found!
 UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
 UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
 UnityEngine.Logger:Log(LogType, Object)
 UnityEngine.Debug:Log(Object)
 AvatarScaling:CreateSkeleton() (at Assets\Scripts\AvatarScaling.cs:212)
 AvatarScaling:BuildScaledHumanDescription(Avatar) (at Assets\Scripts\AvatarScaling.cs:177)
 AvatarScaling:LateUpdate() (at Assets\Scripts\AvatarScaling.cs:132)
  
 (Filename: Assets/Scripts/AvatarScaling.cs Line: 212)
 
 Invalid AABB a
  
 (Filename: C:\buildslave\unity\build\Runtime/Geometry/Intersection.cpp Line: 636)
 
 Invalid AABB a
  
 ...
  
 (Filename: C:\buildslave\unity\build\Runtime/Geometry/Intersection.cpp Line: 592)
 
 Invalid AABB a
 
 Assertion failed on expression: 'IsFinite(d)'
 UnityEditor.Handles:Internal_DrawCameraWithGrid(Camera, DrawCameraMode, DrawGridParameters&, Boolean)
 UnityEditor.Handles:DrawCameraImpl(Rect, Camera, DrawCameraMode, Boolean, DrawGridParameters, Boolean, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Handles.cs:1351)
 UnityEditor.Handles:DrawCameraStep1(Rect, Camera, DrawCameraMode, DrawGridParameters, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Handles.cs:1374)
 UnityEditor.SceneView:DoDrawCamera(Rect, Rect, Boolean&) (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1754)
 UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:2331)
 System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
 System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
 System.Reflection.MethodBase:Invoke(Object, Object[])
 UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:359)
 UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:353)
 UnityEditor.HostView:InvokeOnGUI(Rect, Rect) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:322)
 UnityEditor.DockArea:DrawView(Rect, Rect, Boolean, Boolean) (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:374)
 UnityEditor.DockArea:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:341)
 UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:281)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:483)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent() (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:458)
 UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh(DrawParams, Boolean, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderers.cs:113)
 UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain(RenderChainCommand, Rect, Matrix4x4, Texture, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderDevice.cs:886)
 UnityEngine.UIElements.UIR.UIRenderDevice:DrawChain(RenderChainCommand, Rect, Matrix4x4, Texture, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderDevice.cs:986)
 UnityEngine.UIElements.UIR.RenderChain:Render(Rect, Matrix4x4) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRChainBuilder.cs:233)
 UnityEngine.UIElements.UIRRepaintUpdater:DrawChain(Rect, Matrix4x4) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRRepaintUpdater.cs:66)
 UnityEngine.UIElements.UIRRepaintUpdater:Update() (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRRepaintUpdater.cs:54)
 UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTree() (at C:\buildslave\unity\build\Modules\UIElements\VisualTreeUpdater.cs:72)
 UnityEngine.UIElements.Panel:Repaint(Event) (at C:\buildslave\unity\build\Modules\UIElements\Panel.cs:637)
 UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:240)
 UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:78)
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:179)
 UnityEditor.EditorApplication:Step()
 UnityEditor.Toolbar:DoPlayButtons(Boolean) (at C:\buildslave\unity\build\Editor\Mono\GUI\Toolbar.cs:452)
 UnityEditor.Toolbar:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\Toolbar.cs:248)
 UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:281)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:483)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:466)
 UnityEngine.UIElements.IMGUIContainer:HandleEvent(EventBase) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:447)
 UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Modules\UIElements\Events\MouseCaptureDispatchingStrategy.cs:93)
 UnityEngine.UIElements.EventDispatcher:ProcessEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Modules\UIElements\EventDispatcher.cs:280)
 UnityEngine.UIElements.EventDispatcher:Dispatch(EventBase, IPanel, DispatchMode) (at C:\buildslave\unity\build\Modules\UIElements\EventDispatcher.cs:156)
 UnityEngine.UIElements.BaseVisualElementPanel:SendEvent(EventBase, DispatchMode) (at C:\buildslave\unity\build\Modules\UIElements\Panel.cs:190)
 UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:255)
 UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:78)
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:179)
 
 [C:\buildslave\unity\build\Runtime/Camera/RenderLoops/ReplacementRenderLoop.cpp line 69] 
 (Filename: C:/buildslave/unity/build/Editor/Mono/Handles.cs Line: 1351)
 
 ...
 
 Assertion failed on expression: 'IsFinite(outDistanceForSort)'
 UnityEditor.Handles:Internal_DrawCameraWithGrid(Camera, DrawCameraMode, DrawGridParameters&, Boolean)
 UnityEditor.Handles:DrawCameraImpl(Rect, Camera, DrawCameraMode, Boolean, DrawGridParameters, Boolean, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Handles.cs:1351)
 UnityEditor.Handles:DrawCameraStep1(Rect, Camera, DrawCameraMode, DrawGridParameters, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Handles.cs:1374)
 UnityEditor.SceneView:DoDrawCamera(Rect, Rect, Boolean&) (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1754)
 UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:2331)
 System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
 System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
 System.Reflection.MethodBase:Invoke(Object, Object[])
 UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:359)
 UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:353)
 UnityEditor.HostView:InvokeOnGUI(Rect, Rect) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:322)
 UnityEditor.DockArea:DrawView(Rect, Rect, Boolean, Boolean) (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:374)
 UnityEditor.DockArea:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:341)
 UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:281)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:483)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent() (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:458)
 UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh(DrawParams, Boolean, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderers.cs:113)
 UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain(RenderChainCommand, Rect, Matrix4x4, Texture, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderDevice.cs:886)
 UnityEngine.UIElements.UIR.UIRenderDevice:DrawChain(RenderChainCommand, Rect, Matrix4x4, Texture, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderDevice.cs:986)
 UnityEngine.UIElements.UIR.RenderChain:Render(Rect, Matrix4x4) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRChainBuilder.cs:233)
 UnityEngine.UIElements.UIRRepaintUpdater:DrawChain(Rect, Matrix4x4) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRRepaintUpdater.cs:66)
 UnityEngine.UIElements.UIRRepaintUpdater:Update() (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRRepaintUpdater.cs:54)
 UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTree() (at C:\buildslave\unity\build\Modules\UIElements\VisualTreeUpdater.cs:72)
 UnityEngine.UIElements.Panel:Repaint(Event) (at C:\buildslave\unity\build\Modules\UIElements\Panel.cs:637)
 UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:240)
 UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:78)
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:179)
 UnityEditor.EditorApplication:Step()
 UnityEditor.Toolbar:DoPlayButtons(Boolean) (at C:\buildslave\unity\build\Editor\Mono\GUI\Toolbar.cs:452)
 UnityEditor.Toolbar:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\Toolbar.cs:248)
 UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:281)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:483)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:466)
 UnityEngine.UIElements.IMGUIContainer:HandleEvent(EventBase) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:447)
 UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Modules\UIElements\Events\MouseCaptureDispatchingStrategy.cs:93)
 UnityEngine.UIElements.EventDispatcher:ProcessEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Modules\UIElements\EventDispatcher.cs:280)
 UnityEngine.UIElements.EventDispatcher:Dispatch(EventBase, IPanel, DispatchMode) (at C:\buildslave\unity\build\Modules\UIElements\EventDispatcher.cs:156)
 UnityEngine.UIElements.BaseVisualElementPanel:SendEvent(EventBase, DispatchMode) (at C:\buildslave\unity\build\Modules\UIElements\Panel.cs:190)
 UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:255)
 UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:78)
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:179)
 
 [C:\buildslave\unity\build\Runtime/Camera/RenderLoops/RenderLoopPrivate.cpp line 128] 
 (Filename: C:/buildslave/unity/build/Editor/Mono/Handles.cs Line: 1351)
 
 Assertion failed on expression: 'IsFinite(outDistanceAlongView)'
 UnityEditor.Handles:Internal_DrawCameraWithGrid(Camera, DrawCameraMode, DrawGridParameters&, Boolean)
 UnityEditor.Handles:DrawCameraImpl(Rect, Camera, DrawCameraMode, Boolean, DrawGridParameters, Boolean, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Handles.cs:1351)
 UnityEditor.Handles:DrawCameraStep1(Rect, Camera, DrawCameraMode, DrawGridParameters, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Handles.cs:1374)
 UnityEditor.SceneView:DoDrawCamera(Rect, Rect, Boolean&) (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1754)
 UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:2331)
 System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
 System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
 System.Reflection.MethodBase:Invoke(Object, Object[])
 UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:359)
 UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:353)
 UnityEditor.HostView:InvokeOnGUI(Rect, Rect) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:322)
 UnityEditor.DockArea:DrawView(Rect, Rect, Boolean, Boolean) (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:374)
 UnityEditor.DockArea:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:341)
 UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:281)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:483)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent() (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:458)
 UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh(DrawParams, Boolean, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderers.cs:113)
 UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain(RenderChainCommand, Rect, Matrix4x4, Texture, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderDevice.cs:886)
 UnityEngine.UIElements.UIR.UIRenderDevice:DrawChain(RenderChainCommand, Rect, Matrix4x4, Texture, Exception&) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRenderer\UIRenderDevice.cs:986)
 UnityEngine.UIElements.UIR.RenderChain:Render(Rect, Matrix4x4) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRChainBuilder.cs:233)
 UnityEngine.UIElements.UIRRepaintUpdater:DrawChain(Rect, Matrix4x4) (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRRepaintUpdater.cs:66)
 UnityEngine.UIElements.UIRRepaintUpdater:Update() (at C:\buildslave\unity\build\Modules\UIElements\Renderer\UIRRepaintUpdater.cs:54)
 UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTree() (at C:\buildslave\unity\build\Modules\UIElements\VisualTreeUpdater.cs:72)
 UnityEngine.UIElements.Panel:Repaint(Event) (at C:\buildslave\unity\build\Modules\UIElements\Panel.cs:637)
 UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:240)
 UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:78)
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:179)
 UnityEditor.EditorApplication:Step()
 UnityEditor.Toolbar:DoPlayButtons(Boolean) (at C:\buildslave\unity\build\Editor\Mono\GUI\Toolbar.cs:452)
 UnityEditor.Toolbar:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\Toolbar.cs:248)
 UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:281)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:483)
 UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:466)
 UnityEngine.UIElements.IMGUIContainer:HandleEvent(EventBase) (at C:\buildslave\unity\build\Modules\UIElements\IMGUIContainer.cs:447)
 UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Modules\UIElements\Events\MouseCaptureDispatchingStrategy.cs:93)
 UnityEngine.UIElements.EventDispatcher:ProcessEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Modules\UIElements\EventDispatcher.cs:280)
 UnityEngine.UIElements.EventDispatcher:Dispatch(EventBase, IPanel, DispatchMode) (at C:\buildslave\unity\build\Modules\UIElements\EventDispatcher.cs:156)
 UnityEngine.UIElements.BaseVisualElementPanel:SendEvent(EventBase, DispatchMode) (at C:\buildslave\unity\build\Modules\UIElements\Panel.cs:190)
 UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:255)
 UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\UIElements\UIElementsUtility.cs:78)
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:179)
 
 [C:\buildslave\unity\build\Runtime/Camera/RenderLoops/RenderLoopPrivate.cpp line 129] 
 (Filename: C:/buildslave/unity/build/Editor/Mono/Handles.cs Line: 1351)
 

Here is the script:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 [RequireComponent(typeof(Avatar))]
 public class AvatarScaling : MonoBehaviour
 {
     public float avatarHeight = 1.7f;
     [Range(1f, 2.5f)]
     public float playerHeight = 1.78f;
     [Range(0.1f, 0.7f)]
     public float upperArmLength = 0.28f;
     [Range(0.1f, 0.7f)]
     public float lowerArmLength = 0.27f;
     private float oldUpperArmLength, oldLowerArmLength;
 
     private Transform shoulderJointLeft;
     private Transform elbowJointLeft;
     private Transform wristJointLeft;
     private Transform shoulderJointRight;
     private Transform elbowJointRight;
     private Transform wristJointRight;
 
     private float[] lowerArmSubsegmentProportion;
     private Transform[] lowerArmSubsegmentTransformRight;
     private Transform[] lowerArmSubsegmentTransformLeft;
 
     private float[] upperArmSubsegmentProportion;
     private Transform[] upperArmSubsegmentTransformRight;
     private Transform[] upperArmSubsegmentTransformLeft;
 
     private Vector3 initScale;
     private Animator animator;
 
     //Tried with Start instead, but nothing changed.
     void Awake()
     {
         //Get all the references
         animator = GetComponent<Animator>();
         shoulderJointLeft = animator.GetBoneTransform(HumanBodyBones.LeftUpperArm);
         elbowJointLeft = animator.GetBoneTransform(HumanBodyBones.LeftLowerArm);
         wristJointLeft = animator.GetBoneTransform(HumanBodyBones.LeftHand);
         shoulderJointRight = animator.GetBoneTransform(HumanBodyBones.RightUpperArm);
         elbowJointRight = animator.GetBoneTransform(HumanBodyBones.RightLowerArm);
         wristJointRight = animator.GetBoneTransform(HumanBodyBones.RightHand);
 
         //Building the arrays for the proportions and transforms of the lower arm
         List<float> lowerArmSubsegmentProportionList = new List<float>();
         List<Transform> lowerArmSubsegmentTransformRightList = new List<Transform>();
         List<Transform> lowerArmSubsegmentTransformLeftList = new List<Transform>();
         Transform parentJoint = wristJointRight;
         float totalDist = (wristJointRight.position - elbowJointRight.position).magnitude;
         while (parentJoint != elbowJointRight)
         {
             float dist = (parentJoint.position - parentJoint.parent.position).magnitude;
             lowerArmSubsegmentProportionList.Add(dist / totalDist);
             lowerArmSubsegmentTransformRightList.Add(parentJoint);
             parentJoint = parentJoint.parent;
         }
         parentJoint = wristJointLeft;
         while (parentJoint != elbowJointLeft)
         {
             lowerArmSubsegmentTransformLeftList.Add(parentJoint);
             parentJoint = parentJoint.parent;
         }
         lowerArmSubsegmentProportionList.Reverse();
         lowerArmSubsegmentProportion = lowerArmSubsegmentProportionList.ToArray();
         lowerArmSubsegmentTransformRightList.Reverse();
         lowerArmSubsegmentTransformRight = lowerArmSubsegmentTransformRightList.ToArray();
         lowerArmSubsegmentTransformLeftList.Reverse();
         lowerArmSubsegmentTransformLeft = lowerArmSubsegmentTransformLeftList.ToArray();
 
         //Building the arrays for the proportions and transforms of the upper arm
         List<float> upperArmSubsegmentProportionList = new List<float>();
         List<Transform> upperArmSubsegmentTransformRightList = new List<Transform>();
         List<Transform> upperArmSubsegmentTransformLeftList = new List<Transform>();
         parentJoint = elbowJointRight;
         totalDist = (elbowJointRight.position - shoulderJointRight.position).magnitude;
         while (parentJoint != shoulderJointRight)
         {
             float dist = (parentJoint.position - parentJoint.parent.position).magnitude;
             upperArmSubsegmentProportionList.Add(dist / totalDist);
             upperArmSubsegmentTransformRightList.Add(parentJoint);
             parentJoint = parentJoint.parent;
         }
         parentJoint = elbowJointLeft;
         while (parentJoint != shoulderJointLeft)
         {
             upperArmSubsegmentTransformLeftList.Add(parentJoint);
             parentJoint = parentJoint.parent;
         }
         upperArmSubsegmentProportionList.Reverse();
         upperArmSubsegmentProportion = upperArmSubsegmentProportionList.ToArray();
         upperArmSubsegmentTransformRightList.Reverse();
         upperArmSubsegmentTransformRight = upperArmSubsegmentTransformRightList.ToArray();
         upperArmSubsegmentTransformLeftList.Reverse();
         upperArmSubsegmentTransformLeft = upperArmSubsegmentTransformLeftList.ToArray();
 
         //Scale the overall avatar
         initScale = this.transform.localScale;
         this.transform.localScale = initScale / avatarHeight * playerHeight;
     }
 
     //Tried with Update instead, but nothing changed.
     void LateUpdate()
     {
         if (oldUpperArmLength != upperArmLength || oldLowerArmLength != lowerArmLength)
         {
             Debug.Log("Rescale Avatar");
 
             oldUpperArmLength = upperArmLength;
             oldLowerArmLength = lowerArmLength;
 
             // Creates a new avatar. Inspired from:
             // https://answers.unity.com/questions/1603286/replace-modify-humanoid-avatar-during-runtime.html
             // The scale is now applied in BuildScaledHumanDescription fct.
 
             //Snapshot gameObject's parent and pose
             Vector3 originalPositon = transform.localPosition;
             Quaternion originalRotation = transform.localRotation;
             Vector3 originalScale = transform.localScale;
 
             Transform parent = transform.parent;
 
             //Detach gameObject and place it into the world origin
             transform.SetParent(null, false);
             transform.localPosition = Vector3.zero;
             transform.localRotation = Quaternion.identity;
             transform.localScale = Vector3.one;
 
             //Custom method to create the human description (with the awaited scale)
             HumanDescription description = BuildScaledHumanDescription(animator.avatar);
             //TODO: Find why this lines set the root position to NaN with the two females avatar...
             Avatar avatar = AvatarBuilder.BuildHumanAvatar(gameObject, description);
             // Even the following line creates an issue, so it is not related to the constructed "humanDescription".
             //Avatar avatar = AvatarBuilder.BuildHumanAvatar(gameObject, animator.avatar.humanDescription);
 
             if (avatar.isValid)
             {
                 animator.avatar = avatar;
             }
             else
             {
                 Debug.LogError("Avatar Invalid!");
             }
 
 
             //Reset gameObject's parent and pose
             transform.SetParent(parent, false);
             transform.localPosition = originalPositon;
             transform.localRotation = originalRotation;
             transform.localScale = originalScale;
         }
     }
 
     /// <summary>
     /// Builds the human description object that has the awaited scale.
     /// Inpired from: https://answers.unity.com/questions/622031/how-to-use-avatarbuilderbuildhumanavatar.html
     /// </summary>
     /// <param name="avatar"></param>
     /// <returns></returns>
     private HumanDescription BuildScaledHumanDescription(Avatar avatar)
     {
         HumanDescription humanDescription = new HumanDescription();
         //Reuse the same description
         humanDescription.human = avatar.humanDescription.human;
 
         //Create the skeleton with correct shape. 
         // 1) Put to T-Pose and apply the scale
         MoveToTPose();
         // 2) Apply the scale
         Scale(shoulderJointLeft, elbowJointLeft, upperArmLength);
         Scale(shoulderJointRight, elbowJointRight, upperArmLength);
         Scale(elbowJointLeft, wristJointLeft, lowerArmLength);
         Scale(elbowJointRight, wristJointRight, lowerArmLength);
         // 3) Create all the corresponding CreateSkeletonBone
         humanDescription.skeleton = CreateSkeleton();
 
         humanDescription.upperArmTwist = avatar.humanDescription.upperArmTwist;
         humanDescription.lowerArmTwist = avatar.humanDescription.lowerArmTwist;
         humanDescription.upperLegTwist = avatar.humanDescription.upperLegTwist;
         humanDescription.lowerLegTwist = avatar.humanDescription.lowerLegTwist;
         humanDescription.armStretch = avatar.humanDescription.armStretch;
         humanDescription.legStretch = avatar.humanDescription.legStretch;
         humanDescription.feetSpacing = avatar.humanDescription.feetSpacing;
 
         return humanDescription;
     }
 
     /// <summary>
     /// Create the skeleton based on the one from the attached avatar (to this GameObject).
     /// It assumes that the avatar is in T-Pose (so the scale are conserved).
     /// </summary>
     /// <returns></returns>
     public SkeletonBone[] CreateSkeleton()
     {
         Dictionary<string, Transform> dictTransforms = new Dictionary<string, Transform>();
         Transform[] children = transform.GetComponentsInChildren<Transform>();
         foreach (Transform child in children)
         {
             dictTransforms[child.name] = child;
         }
 
         SkeletonBone[] oldSkeleton = animator.avatar.humanDescription.skeleton;
         SkeletonBone[] newSkeleton = new SkeletonBone[oldSkeleton.Length];
         for (int i = 0; i < newSkeleton.Length; i++)
         {
             newSkeleton[i] = new SkeletonBone();
             newSkeleton[i].name = oldSkeleton[i].name;
             if (!dictTransforms.ContainsKey(newSkeleton[i].name))
             {
                 Debug.Log(newSkeleton[i].name + " not found!");
                 newSkeleton[i].position = oldSkeleton[i].position;
                 newSkeleton[i].rotation = oldSkeleton[i].rotation;
                 newSkeleton[i].scale = oldSkeleton[i].scale;
             }
             else
             {
                 newSkeleton[i].position = dictTransforms[newSkeleton[i].name].localPosition;//oldSkeleton[i].position;
                 newSkeleton[i].rotation = dictTransforms[newSkeleton[i].name].localRotation;//oldSkeleton[i].rotation;
                 newSkeleton[i].scale = dictTransforms[newSkeleton[i].name].localScale;//oldSkeleton[i].rotation;
             }
         }
 
         return newSkeleton;
     }
 
     /// <summary>
     /// Methods to put the avatar in T-Pose (by changing all rotation and positions).
     /// </summary>
     private void MoveToTPose()
     {
         Dictionary<string, Transform> dictTransforms = new Dictionary<string, Transform>();
         Dictionary<Transform, Vector3> dictPriorPositions = new Dictionary<Transform, Vector3>();
         Transform[] children = transform.GetComponentsInChildren<Transform>();
         foreach (Transform child in children)
         {
             dictTransforms[child.name] = child;
             dictPriorPositions[child] = child.position;
         }
 
         foreach (SkeletonBone bone in animator.avatar.humanDescription.skeleton)
         {
             if (!dictTransforms.ContainsKey(bone.name))
             {
                 Debug.Log("[Move To TPose]:\tBone not found:" + bone.name);
             }
             else
             {
                 Transform t = dictTransforms[bone.name];
                 t.localRotation = bone.rotation;
                 t.localPosition = bone.position;
             }
         }
     }
 
     private HumanBone CreateHumanBone(string animatorName, string goName)
     {
         HumanBone humanBone = new HumanBone();
         humanBone.humanName = animatorName;
         humanBone.boneName = goName;
         return humanBone;
     }
 
     private void Scale(Transform start, Transform end, float length)
     {
         float currentLength = (end.position - start.position).magnitude;
         if (end.parent == start)
         {
             end.position = start.position + (end.position - start.position) / currentLength * length;
         }
         else
         {
             float lengthToParent = Vector3.Project(end.position - end.parent.position, end.position - start.position).magnitude;
             Scale(end.parent, end, lengthToParent / currentLength * length);
             Scale(start, end.parent, (currentLength - lengthToParent) / currentLength * length);
         }
     }
 }
 

I tried to debug the error, and it seems that the root transform of the avatar received a (NaN, NaN, NaN) position as soon as I build the new avatar (line 134 of previous script). This can be seen in the inspector of the root bone once the scene has started. Thinking it might be due to my code building the new "humanDescription", I tested with the line 136 (now commented) that uses the same humanDescription as the existing avatar and it's not working either (which, for me, exclude all the code in my own methods (BuildScaledHumanDescription, CreateSkeleton, MoveToTPose, CreateHumanBone, and Scale) to be responsible of the error.

Then I checked about the definition and importation parameters of my avatars. They appear to be all made with MakeHuman, exported in .fbx with a similar configuration, and imported with the same import setting. I checked in Unity and no segment has any null, infinity, nor NaN value in their transforms.

In order to understand better the issue, I tried several configurations, but the problem was identical.

  • On another computer (also on Windows)

  • From a blank project importing all the necessary assets

  • In a more up to date Unity (2019.2.13f1) version (previously it was 2019.2.0f1)

My conclusion is that a bug exists within the "AvatarBuilder.BuildHumanAvatar(...)" function that doesn't show with some avatar (I don't understand why).

I already reported it to Unity as a bug, but I am posting a question here to know if someone has already seen that kind of issue and how to correct/bypass it. I can't, unfortunately, attach the concerned avatar to this post for you to reproduce it (but the bug report has them). Does someone have some experiment with AvatarBuilder and have any idea?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Laiken · Sep 05, 2020 at 10:56 PM

This will only work for specific cases but hopefully this will help someone:

If I import a character from DAZ (like genesis8) and change the object name to something else in blender (for instance, from 'Genesis8Female' to 'Genesis8Female2') the problem described here happens in unity. If I edit back to the original name ('Genesis8Female') in blender the problem vanishes.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

229 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Rigidbody / Animator Moving Y Position - bug? 1 Answer

inspector GUI in animator bugged when trying to add behaviour 2 Answers

Disable Avatar Mask 1 Answer

Can't add condition to a transition in animator controller 0 Answers

Using an Avatar locks Movement in Character When Animating 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges