Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Impossible to debug Animation Component in Visual Studio

Discussion in 'Android' started by Davex6, May 23, 2023.

  1. Davex6

    Davex6

    Joined:
    Mar 29, 2023
    Posts:
    49
    Ok, I'm not sure this is just an Android problem, but given the animations often act differently in the editor/simulator than on the device, it could be.
    Basically, in the editor (v_2021.3.21f1) it is possible to see all the properties of the Animation Component in Visual Studio 2019. On the physical device (rhs image) it just shows the base. This makes it somewhat difficult to debug, and I wondered if it is just me with this problem?

    AniCompDebug.png

    Update:
    Have made a small test project, and it turns out that if the scripting backend is Mono then the debugger works fine. Altering to IL2CPP causes the above problem.
    A workaround is to fill the properties manually. They all seem to be filled correctly and can be manipulated in code (at least those I've tested so far).
    The reason I got a bit panicked over this, is that an animation that works in Editor and had previously worked in Android suddenly stopped working in Android. I was unsure if the above problem was causing the stopped animation, but am now pretty sure that is not the case. It is, anyway, a massive pain in the build.
     
    Last edited: May 24, 2023
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Yeah, this looks like a debug in the IL2CPP debugger implementation. It is certainly something that we want to correct. Can you submit a bug report with a project that causes this? These bugs are often very specific to the code being debugged, so having the same project you are using will be really helpful.

    https://unity.com/releases/editor/qa/bug-reporting
     
  3. Davex6

    Davex6

    Joined:
    Mar 29, 2023
    Posts:
    49
    Ok, I just tried to do that and at 12Mbps it is going to take quite a while. It is too late to continue now, will wait until morning. I noticed there are forum posts about this going back years, maybe more bandwidth from your end?
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Ahh, that is not great, sorry. Unfortunately I'm not involved in the bug reporter, so I can't help much on that end.
     
  5. ScottHFerguson

    ScottHFerguson

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    7
    These properties aren't being displayed because on the IL2CPP builds they are being removed by managed code stripping. Managed stripping is still enabled even when script debugging is enabled and we have no plans to change that. If those properties were reference elsewhere they would still exist at runtime for the debugger to examine.

    By default user code is not stripped so adding a method that is not called, but accesses the properties will ensure that the properties preserved.

    Code (CSharp):
    1.  
    2. void NotUsed()
    3. {
    4.     Animation a = null;
    5.     GC.KeepAlive(a.animatePhysics);
    6.     GC.KeepAlive(a.clip);
    7.     GC.KeepAlive(a.cullingType);
    8.     GC.KeepAlive(a.isPlaying);
    9.     GC.KeepAlive(a.localBounds);
    10.     GC.KeepAlive(a.playAutomatically);
    11.     GC.KeepAlive(a.wrapMode);
    12. }
    13.  
     
    JoshPeterson likes this.