Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question AR Foundation Body Tracking 3D Not Working

Discussion in 'AR' started by Doraemon231, Aug 18, 2023.

  1. Doraemon231

    Doraemon231

    Joined:
    Dec 18, 2018
    Posts:
    22
    I'm looking into Character 3D body tracking.
    I wrote the same code as yours and ran it,
    My project is not running.
    Just bring the HumanBodyTracker.cs and BoneController.cs scripts in the BodyTracking3D scene in the AR Foundation Sample Project. Everything is the same as the script I wrote, and what is the diffrence
    "namespace UnityEngine.XR.ARFoundation.Samples"

    The only difference is whether or not to use .
    So, when I deleted the namespace of the script in the sample scene, body tracking did not work.
    What the hell "namespace UnityEngine.XR.ARFoundation.Samples"
    What do you get from , so only your code runs?
     
  2. xiennastudio

    xiennastudio

    Joined:
    Aug 2, 2023
    Posts:
    19
  3. Doraemon231

    Doraemon231

    Joined:
    Dec 18, 2018
    Posts:
    22
    Thank you for answer. I'm not ignorant of that, but I don't understand why I need to refer to "Sample" to implement a basic function.
     
  4. Doraemon231

    Doraemon231

    Joined:
    Dec 18, 2018
    Posts:
    22
    Here is the error message I received from Xcode:

    A scripted object (probably UnityEngine.XR.ARFoundation.Samples.BoneController?) has a different serialization layout when loading. (Read 32 bytes but expected 44 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts? The referenced script (UnityEngine.XR.ARFoundation.Samples.HumanBodyTracker) on this Behaviour is missing!


    I thought it was an error that Serialize did not work properly, so I deleted the Library folder and reopened it to build it. Body tracking works without ARFoundation.Samples.
     
  5. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    835
    Are you familiar with assembly definitions? https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html

    It looks like you are moving scripts from our
    Assets/Scripts/Runtime
    directory to some other location in the project.
    Assets/Scripts/Runtime
    has an assembly definition associated with it. If you move scripts into or out of that directory, they actually become different types, and you will need to rebuild any scenes that contain those scripts because the type has changed. (Remove the old missing script, and re-add the component in its new assembly)

    Deleting a script's namespace also changes its type, so the same situation applies-- you would need to remove the missing scripts and re-add the new types to the scene.

    This is why I suspect you might be seeing missing script errors
     
    Last edited: Aug 22, 2023
    Doraemon231 likes this.