Suggestion: Replace C# events in MonoManager with Unity Events

NodeCanvas Forums Support Suggestion: Replace C# events in MonoManager with Unity Events

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11996
    zsoik
    Participant

    I was profiling our gamelogic today and saw that the MonoManager update method took a lot of our frametime. I wanted to investigate which graphs are taking up how much, but that wasn’t very easy.
    Reason: MonoManager uses C# events, which use a very fancy recursive call which makes looking at the call tree in the profiler very messy:

    Update of three graphs:

    Imagine this with 300 graphs and you run out of screen real estate very quickly, not to mention actually finding a particular graph you’re looking for.
    As a countermeasure, I replaced the C# events in MonoManager with UnityEngine.Events.UnityEvent, which now produces a flat call list:

    and is much easier to profile (and maybe even faster in execution?).

    Maybe this would be a good change to allow better profiling out-of-the-box.

    NC 2.6.4 / Unity 5.5.2p4

    #11997
    Gavalakis
    Keymaster

    Hey,

    Hmm. I will take a look at this, but I’d also like to suggest an alternative for you, that being using the Unity Profiler API.
    You can open up Graph.cs and change method “UpdateGraph” to be like this for example:

    Doing this, will also make the graphs show much more orderly in the Profiler:
    Profiler

    Let me know what you think.
    Cheers!

    Join us on Discord: https://discord.gg/97q2Rjh

    Attachments:
    You must be logged in to view attached files.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.