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. Dismiss Notice

[Released] Transform Changes Debugger

Discussion in 'Assets and Asset Store' started by ChrisHandzlik, Nov 15, 2021.

  1. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198

    Get It on Asset Store | Website | Documentation

    Have you ever tried to debug transform that's not behaving as it should?
    - maybe in some random frames, position is not where it should be - making it 'jitter' a bit?
    - perhaps its rotation is completely messed up?
    - or scale goes all odd destroying the shape?

    I bet you did and you've likely found that it's DIFFICULT to pinpoint the exact code/game-object that's causing the issue, as:
    - transforms can be changed MULTIPLE times per frame and EVERY frame
    - they can be changed by absolutely ANY object
    - standard debugging methods are just not enough - attaching a debugger to find specific issue takes AGES, finding where to put a breakpoint is HARD and recompilation every time is simply FRUSTRATING

    I know, I've had to battle with those more times than I'd like to admit. This tool is a solution that'll change the way you troubleshoot from painful to simple.


    VIEW ALL TRANSFORM CHANGES IN AN INTUITIVE NODE-GRAPH
    FRAME-BY-FRAME


    Any change, any transform, any frame - displayed in an easy to navigate node-graph with powerful GUI that'll enable you to quickly identify hard to find transform issues.

    No more guessing in your debugging process - every change will be recorded and displayed, you'll quickly get information about:

    - Game Object that initiated change (eg. Mover-01)
    - with a single click you can see that object in Hierarchy View - this goes beyond just seeing script that causes the issue, you may be after a specific object instance as the issue could be due to individual setup
    - Script and Method name
    - exact place in code where change originated (eg. HardToFindScript.cs - method: IntroduceTransformJitterJustToFrustrateDeveloper())
    - navigate directly to the code with a mouse click to find out why it's causing issues

    - New Value
    - actual value that's been set, this makes it much simpler to pinpoint changes that are out of line

    - Actual method Call and method arguments that caused the change
    - all methods/setters affecting transform will be captured
    - could be Transform.set_postion setter
    - or more complex Transform.Translate(float x, float y, float z)
    - whatever it is - you'll get those details

    REPLAY CHANGES IN GAME/SCENE VIEW
    Not only you can view and inspect changes in a friendly manner - you can go one step further and REPLAY them directly in Scene/Game view with a single click.

    This means you don't have to focus on raw numbers you can simply and visually inspect suspicious changes and directly see if they cause the issue you're trying to find.


    QUICKLY IDENTIFY AND TEMPORALIRY DISABLE SPECIFIC TRANSFORM MODIFIERS TO FIND THE ONE THAT'S CAUSING ISSUES
    Tool groups changes by originating Game-Object-instance / Script and Method-name into Transform Modifiers

    - this makes it easy for you to see at a glance which code is affecting the object in current frame-range
    It also allows you to quickly turn them on/off via checkbox directly from gui with NO compilation needed!
    - you can now instantly turn them off one by one and see in Game/Scene view how your tracked object is affected
    - with that approach, it'll only take you few moments (instead of sometimes a few hours) to pinpoint that hard to find code that's causing the issue

    VERY SIMPLE SETUP
    Setup is pretty much non-existent:
    1. import the asset
    2. add 'TrackTransformChanges' script to objects you want to be tracked
    3. hit play
    That's it. No-fuss.

    The tool is designed to integrate into your workflow seamlessly, you should see its load time under 0.5f second (and that is ONLY when you're using it).

    WELL DOCUMENTED API ALLOWS YOU TO EXTEND BEYOND WHAT I THOUGHT OF
    GUI is built on top of API that's well documented and allows you to programmatically:
    - track specific transform changes
    - skip changes based on passed predicate/s
    - access changes data structures that can be grouped by object / frame / TransformModifier

    With that, you can tackle more complex debugging scenarios when you have a better idea of what you're after.

    Have a look in docs pages to see what's avaialable:
    https://immersiveVRTools.com/projects/transform-changes-debugger/documentation


    WHAT IS NOT SUPPORTED (YET)
    • physics originating changes - gravity / rigidbody movements (say via AddForce()). For now, it's best to temporarily turn rigidbody off when debugging
    • changes made outside of the main thread
    • methods changing more than a single transform property, eg 'SetPositionAndRotation' - will be captured as a position change (you'll still get correct information about method and method arguments)
    • production builds - while this tool will work in production build it'll likely affect performance - it's been designed as an editor / debugging tool.
    • NET Standard 2.0 API Compatibility level - currently you have to use .NET 4.x
     
    Last edited: Nov 16, 2021
  2. NelsonHurst

    NelsonHurst

    Joined:
    Dec 4, 2014
    Posts:
    14
    Nice Tool.
    However, they are too many warning messages for a clean install.
    • Remove the double directives (using statements at the top). They cause unnecessary warning messages.
    • Add a null check on nodes before calling nodes.Clear() in the Clear method of XNode.NodeGraph class.
    • Maybe create a private method of GetThreePointAngle in the AngleBetweenPoints class, and have the GetThreePointAngleSigned180 and GetThreePointAngleUnsigned360 call it. When those methods call the GetThreePointAngle method, it gives the Obsolete method warning.
    Other than those minor things, this is a very useful tool. Nice work.
     
  3. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    @NelsonHurst glad you like it and appreciate your feedback, I'll get those sorted for the next release.
     
    Last edited: Apr 14, 2022
  4. CW3MH6

    CW3MH6

    Joined:
    Jul 4, 2013
    Posts:
    11
    Hi,

    I attempted to use your asset but ran into some issues.

    #1. If you have Odin installed, the asset does not compile successfully after import. There are a number of namespace additions/changes that must be done.

    #2. After making those changes, it will successfully compile but not track transform changes, even after patching all User Code assemblies and adding a Track Transform Changes component to the GameObject in question.

    It does say "No methods found to patch" next to the enabled Assemblies.

    Do you have any suggestions on what I can change to maybe fix it?

    Thanks
     
  5. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Hi @CW3MH6,

    I'll double check with Odin installed as I didn't test that before.

    I think it depends on the changes you had to make, perhaps some change actually affected functionality.

    Can you please try to use it in the project without Odin (just to test that it's that and not something else).

    Alternatively if you have a small reproduction project I can have a look.

    Thanks,
    Chris
     
  6. SideSwipe9th

    SideSwipe9th

    Joined:
    Jan 10, 2019
    Posts:
    46
    Hi @ChrisHandzlik

    I've ran into some of the same issues as CW3MH6, plus a few more. I'm using Unity 2021.3.0f1 for this.

    First the Odin Inspector issues. In order to get the asset to compile I had to add the following code to InputAttributeDrawer.cs, OutputAttributeDrawer.cs, and InNodeEditorAttributeProcessor.cs:
    using TransformChangesDebugger.Editor.XNode;

    I also had change line 18 in GraphAndNodeEditor.cs to read:
    NodeEditorWindow.Open(serializedObject.targetObject as global::XNode.NodeGraph);

    And line 49 of the same file to read
    NodeEditorWindow w = NodeEditorWindow.Open(graphProp.objectReferenceValue as global::XNode.NodeGraph);

    Once those changes were made, the asset would compile successfully.

    At least until I changed from .NET Standard to .NET Framework. Once I made that change, there was an error in TransformPatches.cs, relating to the variable jumpLabelAfterSetter, due to it being used while unassigned. The assignment for that variable happens in an if statement, and the compiler seems to think there's a codepath where instructionsInjectedBeforeCurrentInstructions can evaluate as true, without jumpLabelAfterSetter being set. Worked around this by changing line 229 to read
    Label jumpLabelAfterSetter; = new Label();


    Next issue is patching time. I make substantial use of assembly definitions, both for my own code, Unity packages, and for third party assets. Adding even a core subset of assemblies for the character controller (I use Opsive's UCC), packages like Cinemachine, and my own code, entering play mode takes in excess of 60 seconds on my computer (Ryzen 5900X CPU).

    Then, in play mode, the object tracker isn't detecting any changes to an object that has the Track Transform Changes component attached, regardless of what assemblies are patched for tracking. Unfortunately I don't have further time to debug this at the moment. Strangely the object tracker does work in your sample scenes, so I'm not quite sure what is happening here. I know for sure that at least one of the assemblies I've selected is manipulating the transform of the game object, so I'm not sure why I'm not seeing any moves. This issue occurs regardless of whether Unity is in release or debug mode.

    Finally, there's an odd bug when leaving play mode that causes the Assembly list to act as if it is still in play mode. The only workarounds I've found are either restarting Unity, or toggling between release and debug mode.
     
    clarson2974 likes this.
  7. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Thanks @SideSwipe9th, I'll make adjustments to fix those compile time errors.

    The timing to process larger assemblies might not be something that can be easily addressed. Those should be significantly faster after first processing (when assembly is scanned to find all instructions that call transforming methods).

    The changes however should show unless the transform is adjusted by not utilizing methods exposed in the Transform.cs (eg. moving them via physics).

    If you have a small project where the issue can be replicated I can have a look and see what I can do there.
     
  8. makaolachsiungca

    makaolachsiungca

    Joined:
    Sep 27, 2019
    Posts:
    31
    @ChrisHandzlik
    Hi,

    I recently asked you some questions about MissingUnityEvents.

    I'm using custom playable graph to interact with MxmMotionMatching(Animation plugin with burst and job system),
    But often encounter difficult to debug Transform glitch (even does not 100% happen).

    Wish I have this honor to test the compatibility of this plugin with the Job system in Unity 2022 LTS version,
    thank you!
     
  9. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
  10. clarson2974

    clarson2974

    Joined:
    Aug 24, 2015
    Posts:
    20
    First thing - I had been chasing a camera position issue for hours...bought this tool and within 30 minutes found the problem (and that included the install and looking at how to use it). That is awesome. Thank you for making this available on the Asset store, it potentially saved me another several hours/days? of trying to track this down. And now that I know what was doing it, I realize I wasn't even close yet...

    Second thing - I did hit a couple of issues when using it. The first was the error related to jumpLabelAfterSetter being used before initialization. I corrected that with Label jumpLabelAfterSetter = new Label(); as @SideSwipe9th indicated above.

    I was also receiving this:
    System.NullReferenceException: Object reference not set to an instance of an object
    at TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer+<>c.<.cctor>b__0_9 (System.Object sender, TransformChangesDebugger.API.Patches.RedirectSetterMethodsFromCallingCodeResult result) [0x00001] in E:\Development\Unity\ARPG_Farming_Engine\Assets\TransformChangesDebugger\Editor\TransformChangesDebuggerInitializer.cs:90
    at (wrapper delegate-invoke) System.EventHandler`1[TransformChangesDebugger.API.Patches.RedirectSetterMethodsFromCallingCodeResult].invoke_void_object_TEventArgs(object,TransformChangesDebugger.API.Patches.RedirectSetterMethodsFromCallingCodeResult)
    at TransformChangesDebugger.API.Patches.TransformPatches.InterceptMethodsToEnableChangeTracking (HarmonyLib.Harmony harmony, System.Collections.Generic.List`1[T] assemblyPaths) [0x00369] in E:\Development\Unity\ARPG_Farming_Engine\Assets\TransformChangesDebugger\API\Runtime\Patches\TransformPatches.cs:135
    at TransformChangesDebugger.API.TransformChangesDebuggerManager.Initialize (System.Collections.Generic.List`1[T] allAvailableAssyPaths, System.Collections.Generic.List`1[T] assemblyPathsChosenToPatchByUser) [0x00080] in E:\Development\Unity\ARPG_Farming_Engine\Assets\TransformChangesDebugger\API\Runtime\TransformChangesDebuggerManager.cs:99
    at TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer..cctor () [0x001a2] in E:\Development\Unity\ARPG_Farming_Engine\Assets\TransformChangesDebugger\Editor\TransformChangesDebuggerInitializer.cs:95
    UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes (System.Type[])

    Unity version 2021.3.11f1
     
  11. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
  12. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    113
    Hi,
    I seem to be running into the same issues as a couple of the previous posters have when Odin is in the project. Unity version is 2021.3.16f1 LTS). For the NodeEditor error I added
    using TransformChangesDebugger.Editor.XNode;
    For the XNode.NodeGraph I removed XNode.
    It now compiles, however I don't see anything showing up in the Tracker window.
    Here is a video to show the issue
    https://drive.google.com/file/d/1fNJr2zrWlgf2zj8Ickb6PZzsE2wCoZRv/view?usp=sharing
     
  13. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    It looks that on latest change that introduced XNode as a separate asm-def (so it doesn't collide if your already have XNode imported) I've missed references that target ODIN pre-processor directive. Sorry about that.

    Specifying adjusted namespace in those files will help (also there's a link at the end for updated version)

    Code (CSharp):
    1. using TransformChangesDebugger.Editor.XNode;
    for:
    InNodeEditorAttributeProcessor.cs
    OutputAttributeDrawer.cs
    InputAttributeDrawer.cs

    and changing line 17 in
    GraphAndNodeEditor.cs

    from
    Code (CSharp):
    1.  
    2. public override void OnInspectorGUI() {
    3.     if (GUILayout.Button("Edit graph", GUILayout.Height(40))) {
    4.         NodeEditorWindow.Open(serializedObject.targetObject as XNode.NodeGraph);
    5.     }
    6.     base.OnInspectorGUI();
    7. }
    8.  
    to
    Code (CSharp):
    1.  
    2. public override void OnInspectorGUI() {
    3.     if (GUILayout.Button("Edit graph", GUILayout.Height(40))) {
    4.         NodeEditorWindow.Open(serializedObject.targetObject as [B]global[/B]::XNode.NodeGraph); //added global:: before XNode
    5.     }
    6.     base.OnInspectorGUI();
    7. }
    8.  
    will get it to compile

    and same for GraphAndNodeEditor.cs line 48

    Code (CSharp):
    1.  
    2. public override void OnInspectorGUI() {
    3.     if (GUILayout.Button("Edit graph", GUILayout.Height(40))) {
    4.         SerializedProperty graphProp = serializedObject.FindProperty("graph");
    5.         NodeEditorWindow w = NodeEditorWindow.Open(graphProp.objectReferenceValue as global::XNode.NodeGraph); //added global:: before XNODE
    6.         w.Home(); // Focus selected node
    7.     }
    8.     base.OnInspectorGUI();
    9. }
    10.  
    I think you've also got in touch via email, I've sent you link to updated package.
     
  14. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    113
    Thank you for your respones, much appreciated. It now compiles, however I still don't see any of the objects I added the tracker to in the debug window.
     
  15. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Alright,

    If you try demo scene - does that work as expected?

    If so can you please:
    1) select to patch all assemblies (just in case change is originating from some odd place)
    2) make sure game object has tracker component added (as in demo scene)

    If there are still no hits, it's possible that change will be made via physics or ourside of managed code (eg directly by Unity on c++ side).

    If you could share part of your project where issue can be reproduced I'd be happy to have a look.
     
  16. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    @ChrisHandzlik

    Hey Chris, I sent you a couple emails with coexistence issues with Odin and Ultimate Editor Enhancer. If you could please take a look and let me know if these can be fixed?
     
  17. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    I did manage to get rid of the Odin and Ultimate Editor Enhancer coexistence issues by creating a copy of my project and deleting those assets.

    However, Transform Changes Debugger is not capturing any data? I did a short video to show my setup.

    The demo scene works. So I know it is installed properly. Can you confirm the debugger will track changes on prefabs instantiated at runtime? I assume it would, because this is a must have. Can you see a problem with how I am using the tool in the video?

    I tried tracking a simple cube in my startup scene. Nothing was tracked on this either. .

     
    Last edited: Jan 16, 2023
  18. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    @Zaddo, thanks for the video. Everything looks fine.

    I've sent you an email with updated files (but I suspect you applied same fix to get Odin error gone) - just to double check you can re-import the changed files to make sure nothing is broken.

    I know that you had to make some adjustments with harmony.dll as it's also used in other asset.

    You already checked demo scene (was that done in same project?) - if so then it all looks fine on that front.

    For change to be captured transform has to be moved via one of Transform methods / properties (on c# side).

    Say changes originating from physics will not be captured or any changes that are not coming from c# side.

    With yours am I right thinking that zombies move via NavMeshAgent.Move? If so they won't be visible, sorry!
     
  19. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    @ChrisHandzlik Thanks for the quick reply. I did, delete your asset and re-install a clean copy. The demo scene testing and the video were done in this project with the clean install of Transform Changes Debugger.

    A* pathfinding is used for the zombie paths, the character movement is controlled by Opsive's Ultimate Character Controller, which sets the position/rotation in C# code. I have copied the method below that sets the position, m_Transform is the zombie's transform.

    I rebooted my computer, just to make sure nothing in the Unity state was causing an issue. The zombie movements are still not being tracked by the debugger.

    I just tried another test. I created a cube in the main scene (without a collider), and attached the "Track Transform Changes" component. I modified the ApplyPosition Method below to move the cube so it sat on the zombie. The cube movement also was not tracked by the debugger?

    When I hit play, the patching assemblies show up for about a minute. And so the code is definitely running to patch and I have included the DLL that is handling this movement.

    Any other thoughts?

    Code (CSharp):
    1.         protected virtual void ApplyPosition()
    2.         {
    3.             // Apply the position.
    4.             var position = m_Transform.position + m_MoveDirection;
    5.             m_Velocity = (position - m_PrevPosition) / (m_TimeScale * Time.deltaTime);
    6.  
    7.             m_Transform.position = m_PrevPosition = position;
    8.             m_MoveDirection = Vector3.zero;
    9.             // Update the platform variables.
    10.             if (m_Platform != null) {
    11.                 m_PlatformRelativePosition = m_Platform.InverseTransformPoint(m_PrevPosition);
    12.             }
    13.         }
     
  20. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Alright tha ks, leave it with me. Today / tomorrow I'll get Opsive asset and will have a look.

    If it's also using harmony maybe it's that somehow causing issues.

    Ps: the asset asks to use .net 4.x backend, just to double check you're not ignorong the prompt when launchng project? As in you're not using .net standard backend?
     
  21. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Actually it was Ultimate Editor Enchancer that had harmony. I'll check that to see if it's not unpatching assemblies by any chance.

    Loading bar is good but it may not indicate that the method you're after was patched.

    It's patching all of them in selected assemblies
     
  22. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    Yes I am using .Net framework, see screen capture.

    I did some more testing:

    I have a test cube in my loading scene with a simple move script on it. The move script is disabled. I trigger the loading of the second scene which will trigger the Opsive UCC assembly to load, this has code that will move the cube in the loading scene. The cube starts moving, but the debugger does not register any movements on the cube.

    I then enable the simple move script on the cube. The debugger starts to register the movements. The debugger was showing some info above, I can't recall the exact wording, but it was advising that there were changes to the transform occurring that were not tracked.

    Is it possible, that your code does not recognize if an assembly is loaded after the first scene completes loading, and cannot detect the C# code in these late loaded assemblies?

    EDIT: I moved the simple move script into the Opsive UCC assembly. Now the debugger won't track movements on the move script. I definitely have the DLL selected on the main debugger window. It seems that for some reason on my System the debugger will only track code outside of an assembly?
     

    Attached Files:

    Last edited: Jan 16, 2023
  23. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Yes - that would make sense. If assembly is not loaded it'll not be patched

    Can you see that DLL in assembly picker before entering playmode?

    If it's only visible after you enter playmode then - you just need to tick it at runtime. It starts patching process for clicked one.

    Let me know if that the case. There'll be APIs that you can call to quickly automate that click if needed
     
  24. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    I can see and select the assembly before going into playmode. Here is a screen shot of the assembly setup.
    debugger.jpg

    I created a new assembly with just the simple move script and had this enabled in my loading scene. the debugger still couldn't track the movements. I next deleted the assembly definition so that the move script was not in assembly, the debugger could now track the movements!! It seems like the debugger cannot track code that is an assembly on my system.

    Also, just regarding your comment about the Ultimate Editor Enhancer might be unloading assemblies. I am still testing in a copy of my project, from which I deleted the Ultimate Editor Enhancer and Odin.
     
    Last edited: Jan 16, 2023
  25. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Alright, thanks that helps narrow it down as it's unlikely to be related to other asset.

    I've checked similar setup with asmdef on my end just now and it looks ok.

    I think it's best to dig into a quick debugging session to find what's happening.

    I appreciate you taking the time to look into this one and also I'm aware that's not the point of buying asset - very happy to process a refund for you if you'd prefer that.

    If you want to go further I've put a recording with some steps to help narrow the issue down:
    https://drive.google.com/file/d/1Dr_BtSh76Any_TDRYsjM2xM_9keA3z6l/view?usp=sharing

    The methods I'm referring to in vid:
    TransformChangesDebugger.API.Patches.TransformPatches.InterceptMethodsToEnableChangeTracking
    TransformChangesDebugger.API.Patches.CoreInterceptionPatch.SendMessagePrefix

    Happy to jump on a quick call if that's quicker.
     
  26. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    I found it. It is throwing an IL compile error in this bit of code. My apologies, the debugger was throwing an error, I just missed it because my own code was throwing lots of errors because the copy project wasn't setup correctly and so I didn't look closely.

    Code (CSharp):
    1.                         foreach (var methodInterceptorParam in methodInterceptionParamsForSingleAssy)
    2.                         {
    3.                             try
    4.                             {
    5.                                 var timeTakenToPatchMethodsSingleMethodSw = new Stopwatch();
    6.                                 timeTakenToPatchMethodsSingleMethodSw.Start();
    7.  
    8.                                 var interceptCallParamsForType = TranspiledMethodDefinitions.InterceptionTypeToInterceptCallParameters[methodInterceptorParam.PatchingDueToInterceptedMethodCallFullName];
    9.                                 //PERF: patching can take a while, especially for bigger assy like UnityEngine.Core - how to get that speed up?
    10.                                 harmony.Patch(methodInterceptorParam.MethodDefinition.ResolveReflection(), transpiler: interceptCallParamsForType.Transpiler);
    11.  
    12.                                 perMethodPatchingDurations.Add(methodInterceptorParam, timeTakenToPatchMethodsSingleMethodSw.ElapsedMilliseconds);
    13.                             }
    14.                             catch (Exception e)
    15.                             {
    16.                                 Debug.LogError($"Method Error: {e.Message}");
    17.                             }
    18.                         }
    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer+<>c.<.cctor>b__0_9 (System.Object sender, TransformChangesDebugger.API.Patches.RedirectSetterMethodsFromCallingCodeResult result) [0x00001] in D:\UnityProjects\DeadFearRot\DeadFear3\Assets\TransformChangesDebugger\Editor\TransformChangesDebuggerInitializer.cs:90
    3.   at (wrapper delegate-invoke) System.EventHandler`1[TransformChangesDebugger.API.Patches.RedirectSetterMethodsFromCallingCodeResult].invoke_void_object_TEventArgs(object,TransformChangesDebugger.API.Patches.RedirectSetterMethodsFromCallingCodeResult)
    4.   at TransformChangesDebugger.API.Patches.TransformPatches.InterceptMethodsToEnableChangeTracking (HarmonyLib.Harmony harmony, System.Collections.Generic.List`1[T] assemblyPaths) [0x00369] in D:\UnityProjects\DeadFearRot\DeadFear3\Assets\TransformChangesDebugger\API\Runtime\Patches\TransformPatches.cs:147
    5.   at TransformChangesDebugger.API.TransformChangesDebuggerManager.Initialize (System.Collections.Generic.List`1[T] allAvailableAssyPaths, System.Collections.Generic.List`1[T] assemblyPathsChosenToPatchByUser) [0x00080] in D:\UnityProjects\DeadFearRot\DeadFear3\Assets\TransformChangesDebugger\API\Runtime\TransformChangesDebuggerManager.cs:99
    6.   at TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer..cctor () [0x001a2] in D:\UnityProjects\DeadFearRot\DeadFear3\Assets\TransformChangesDebugger\Editor\TransformChangesDebuggerInitializer.cs:95
    7. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
    8.  
     

    Attached Files:

  27. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    Here is the method that generated the error:

    Code (CSharp):
    1. #if UNITY_EDITOR
    2.         /// <summary>
    3.         /// Function used to create a new controller volume
    4.         /// </summary>
    5.         [MenuItem(m_createVolumeMenuItem)]
    6.         public static void CreateInteriorWeatherControllerVolume()
    7.         {
    8.             GameObject newVolumeObject = new GameObject("New Gaia Interior Weather Volume")
    9.             {
    10.                 transform =
    11.                 {
    12.                     position = SceneView.lastActiveSceneView.camera.transform.position
    13.                 }
    14.             };
    15.  
    16.             InteriorWeatherController interiorController = newVolumeObject.AddComponent<InteriorWeatherController>();
    17.             interiorController.Setup();
    18.  
    19.             BoxCollider boxCollider = newVolumeObject.AddComponent<BoxCollider>();
    20.             boxCollider.size = new Vector3(30f, 30f, 30f);
    21.             boxCollider.isTrigger = true;
    22.  
    23.             Selection.activeObject = newVolumeObject;
    24.             EditorGUIUtility.PingObject(newVolumeObject);
    25.             SceneView.lastActiveSceneView.FrameSelected();
    26.         }
    27. #endif
    28.  
     
  28. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    @Zaddo thanks - I can recreate the issue now.

    It's down to a code pattern that tool rewriting can't handle (assigning value via property initializer) - I've raised a bug for that and will sort it out later. But that may not be quick.

    In the meantime I've added better error handling for patching. Really for patches that fail it should just continue with others rather than fail completely.

    You can find the change here:
    https://github.com/handzlikchris/Un...mmit/89e10e141c794e567ab3dde9e42df40d67ac263e

    Once you apply it your changes should start showing.
     
    Zaddo likes this.
  29. anoworl

    anoworl

    Joined:
    May 4, 2021
    Posts:
    1
    @ChrisHandzlik Very nice assets! Is it compatible with Apple Silicon Mac? I followed the steps below and it didn't work. When I searched the Harmony Issue Tracker, I found https://github.com/pardeike/Harmony/issues/424.

    1. Imported the asset.
    2. Followed the instructions to approve the use of the .NET Framework.
    3. Opened the "Hard to pinpoint jitter" demo from "Quick Start".
    4. Pressed "Play" (from here, I have recorded in the attached video).
    5. Selected "TrackedObject-1" and chose "Open Visual Transform...".
    6. A window appears, but no objects are displayed in the "Tracked Objects" section.
    7. The Console displays an error "Win32Exception: Invalid data", and the word "Harmony" appears in the middle of the stack trace.
    I would appreciate any advice.

    Stack Trace

    Code (CSharp):
    1. Win32Exception: Invalid data
    2. MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.SetMemPerms (System.IntPtr start, System.UInt64 len, MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform+MmapProts prot) (at <88b084d277f344aa9c2904c640976875>:0)
    3. MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.MakeWritable (System.IntPtr src, System.UInt32 size) (at <88b084d277f344aa9c2904c640976875>:0)
    4. MonoMod.RuntimeDetour.DetourHelper.MakeWritable (MonoMod.RuntimeDetour.IDetourNativePlatform plat, MonoMod.RuntimeDetour.NativeDetourData detour) (at <88b084d277f344aa9c2904c640976875>:0)
    5. MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest (System.Reflection.MethodInfo from, System.Reflection.MethodInfo to) (at <88b084d277f344aa9c2904c640976875>:0)
    6. MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor () (at <88b084d277f344aa9c2904c640976875>:0)
    7. MonoMod.RuntimeDetour.Platforms.DetourRuntimeMonoPlatform..ctor () (at <88b084d277f344aa9c2904c640976875>:0)
    8. MonoMod.RuntimeDetour.DetourHelper.get_Runtime () (at <88b084d277f344aa9c2904c640976875>:0)
    9. MonoMod.RuntimeDetour.DetourHelper.Pin[T] (T method) (at <88b084d277f344aa9c2904c640976875>:0)
    10. HarmonyLib.MethodPatcher.CreateReplacement (System.Collections.Generic.Dictionary`2[System.Int32,HarmonyLib.CodeInstruction]& finalInstructions) (at <88b084d277f344aa9c2904c640976875>:0)
    11. HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) (at <88b084d277f344aa9c2904c640976875>:0)
    12. HarmonyLib.PatchProcessor.Patch () (at <88b084d277f344aa9c2904c640976875>:0)
    13. HarmonyLib.Harmony.Patch (System.Reflection.MethodBase original, HarmonyLib.HarmonyMethod prefix, HarmonyLib.HarmonyMethod postfix, HarmonyLib.HarmonyMethod transpiler, HarmonyLib.HarmonyMethod finalizer) (at <88b084d277f344aa9c2904c640976875>:0)
    14. TransformChangesDebugger.API.Patches.CoreInterceptionPatch.PatchSendMessage (HarmonyLib.Harmony harmony) (at Assets/TransformChangesDebugger/API/Runtime/Patches/CoreInterceptionPatch.cs:27)
    15. TransformChangesDebugger.API.TransformChangesDebuggerManager.Initialize (System.Collections.Generic.List`1[T] allAvailableAssyPaths, System.Collections.Generic.List`1[T] assemblyPathsChosenToPatchByUser) (at Assets/TransformChangesDebugger/API/Runtime/TransformChangesDebuggerManager.cs:97)
    16. TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer..cctor () (at Assets/TransformChangesDebugger/Editor/TransformChangesDebuggerInitializer.cs:95)
    17. Rethrow as TypeInitializationException: The type initializer for 'TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer' threw an exception.
    18. TransformChangesDebugger.Editor.TransformChangesDebuggerInitializer+<>c.<.cctor>b__0_0 (System.Object sender, System.EventArgs args) (at Assets/TransformChangesDebugger/Editor/TransformChangesDebuggerInitializer.cs:40)
    19. System.AppDomain.DoDomainUnload () (at <16d1a1e3fafa4d23a275526c945e1b62>:0)
    20.  
     
  30. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Hi @anoworl - thanks! You're right it doesn't support Apple Silicon yet. And the harmony issue you've found is at the core of it.

    It looks like needed change was merged to Harmony in June but I've not yet had a chance to update.

    I'm not quite sure where that'd happen, if Mac is your only use I'd be happy to get it refunded for you.

    Also till it's updated you may find MissingUnityEvents to be helpful. It's not as polished but it achieves very similar goal using slightly different approach that should work on mac
     
  31. BigRedzz

    BigRedzz

    Joined:
    Jul 17, 2023
    Posts:
    2
    [SOLVED] The issue is that we are creating our unit prefabs at runtime, so adding the tracker to another static component allowed me to then track the one I wanted. Might want to give a hint about attaching the component to an object in the scene before runtime in the debugger window itself when nothing is matching...

    Hey @ChrisHandzlik I have been trying to debug an issue with one of our units rotation constantly being set to the wrong direction. I was excited when I found your asset, but I have been unable to get it to work. I think I set everything up as you advise and the example scenes do work.

    Here is a video showing me spawning the unit, confirming it has the Tracker component, even tried re-dragging the unit into the Tracker Debugger which it allows, but it doesn't show anything. I have enabled ALL scriptassemblies and yet I'm not getting any info on position or rotation updates.

    You can see me manually set the rotation Y to 0 in the inspector about halfway through the video and it immediately gets changed back and yet nothing shows in the debugger window... What am I missing?

    We are also using Odin very lightly in some places in our project (I mention this since I see many posts in this thread about issues with it), but I'm not seeing any errors...
     
    Last edited: Oct 23, 2023
  32. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    198
    Cool - glad you found it! Your game looks great.

    Btw. chaning through editor doesn't go via properties / methods on c# side and might not show.
    All the changes that go via managed side, like your scripts / 3rd party scripts will show.