Summary
When profiling Unity games, logic code is often one of the hardest areas to optimize. A single frame can contain hundreds or thousands of function calls, and it can be difficult to tell which function is actually responsible for a performance spike.
The problem becomes even more obvious when call stacks get deeper. You may know that a particular frame is expensive, but still spend a lot of time going through different call paths to find the function that is really contributing to the cost.
GameOptim GOT Online recently added several improvements to its logic code performance analysis, making it easier to move from a large amount of profiling data to the functions that actually matter.
The update focuses on three areas:
- Call stack flame charts for a more visual way to inspect function hierarchies
- Function search and call-stack linking to find the same function across different call paths
- Top 20 reverse-call analysis to quickly identify functions with high self-time and overall impact
So, how can these features make Unity logic code profiling faster?
How Can a Flame Chart Help Find Unity Logic Code Bottlenecks?
Deep call stacks can be difficult to read when you're working with raw profiling data.
A function may call several other functions, which then call more functions. When the hierarchy becomes deep enough, simply reading the call stack doesn't always make it obvious where most of the time is actually being spent.
GameOptim GOT Online now provides a visual flame chart for logic code analysis.
The chart makes the function hierarchy much easier to understand. You can see how execution time is distributed across different functions and drill down into the hierarchy to identify expensive nodes.
The analysis can be performed at different levels:
- Overall test range — Which functions consume most of the total execution time?
- Specific scenario — Which functions are expensive during a particular gameplay sequence or combat scenario?
- Specific frame — Which functions are responsible for a frame-time spike?
This makes it easier to move from a high-level performance overview to a specific function that needs investigation.
Instead of manually following a long call stack, you can visually inspect the hierarchy and quickly narrow down the expensive functions.
How Can You Find the Same Function Across Different Call Paths?
Another common problem during profiling is that the same function can appear in multiple call paths.
For example, a function might be called by several different systems. Looking at only one call stack doesn't necessarily tell you how much that function contributes to the overall performance cost.
GameOptim GOT Online now adds function search to the overall performance trend analysis.
You can search for part of a function name, and the system will perform a fuzzy match against the available functions.
This makes it easier to answer questions such as:
- Where is this function being called?
- Is the same function expensive in multiple systems?
- Which parent functions contribute most to its execution time?
- Does this function become a bottleneck only in a specific gameplay scenario?
More importantly, the function search is linked with the flame chart.
When you search for a function, matching nodes in the call stack are automatically highlighted. Unrelated nodes are temporarily faded out, making the matching functions much easier to spot.
This is particularly useful when the same function appears in multiple branches of a large call tree.
Instead of checking each path manually, GameOptim lets you focus on the matching nodes and build a more complete performance picture of that function.
How Can Reverse Call Analysis Identify Common Bottlenecks?
Sometimes you don't know which function you should investigate in the first place.
In that case, starting from the call tree and manually looking for expensive functions can still take a significant amount of time.
The updated reverse-call analysis in GameOptim GOT Online provides another way to approach the problem.
When you switch to reverse-call analysis, GOT Online lists the Top 20 functions with the highest self-time.
It also calculates their total cost across different calling paths.
This helps answer a slightly different question:
Which functions are expensive regardless of where they are called?
A function may appear in multiple call paths and contribute significant execution time across all of them. Instead of manually checking every path, you can start with the functions that have the largest overall impact.
This can be especially useful when looking for common bottlenecks in gameplay logic, combat systems, AI, update loops, or other frequently executed code.
What Is the Fastest Way to Analyze Unity Logic Code Performance?
There isn't a single profiling view that works for every performance problem.
A practical workflow with GameOptim GOT Online is to combine the three analysis methods:
- Start with the overall performance trend to identify problematic frames or time ranges.
- Use the flame chart to understand the function hierarchy and locate expensive branches.
- Search for specific functions when you already have a suspicious function in mind.
- Use reverse-call analysis to identify functions with high self-time and broad impact.
This gives you both top-down and bottom-up approaches to the same profiling data.
The goal isn't simply to find the function with the largest number.
The more useful question is:
Which function is expensive, why is it being called, and how widely does it affect the frame?
That's where combining different views becomes useful.
FAQ
What is logic code performance analysis in Unity?
Logic code performance analysis focuses on the CPU cost of gameplay and system logic, such as combat, AI, game state updates, and other scripts or functions executed during gameplay.
Tools such as GameOptim GOT Online can help developers inspect function-level execution time and call relationships to identify expensive code paths.
How does GameOptim GOT Online help with Unity profiling?
GameOptim GOT Online provides online performance analysis based on profiling data. For logic code, it provides call-stack visualization, function search, and reverse-call analysis to help developers locate CPU bottlenecks more efficiently.
What is a flame chart useful for in Unity?
A flame chart provides a visual representation of function call relationships and execution time.
In GameOptim GOT Online, the logic code flame chart can be used to inspect the overall test range, specific scenarios, or individual frames, making it easier to identify expensive functions and call paths.
Can I find the same function in multiple Unity call paths?
Yes. GameOptim GOT Online supports function search across the logic code analysis view.
When a function is found in multiple call paths, the corresponding nodes in the flame chart can be highlighted, making it easier to understand how the same function contributes to different execution paths.
What is reverse-call analysis?
Reverse-call analysis starts from individual functions rather than following the call hierarchy from the top.
In GameOptim GOT Online, the reverse-call view can show the Top 20 functions with the highest self-time and analyze their cost across different calling paths.
This can help developers quickly find functions that have a broad performance impact.
Is GameOptim a replacement for the Unity Profiler?
GameOptim GOT Online is not intended to replace the Unity Profiler.
The Unity Profiler remains an important tool for collecting and inspecting profiling data. GameOptim focuses on making large amounts of profiling data easier to analyze, especially when developers need to identify bottlenecks across different frames, scenarios, and call paths.
For teams dealing with complex Unity performance problems, using Unity Profiler together with GameOptim can provide a more complete profiling workflow.
Conclusion
Finding a Unity performance bottleneck is often less about collecting profiling data and more about making sense of it.
When call stacks become large and the same functions appear across multiple paths, manually going through every frame and every hierarchy can quickly become inefficient.
The latest logic code analysis improvements in GameOptim GOT Online provide three practical ways to reduce that overhead:
- Visualize call stacks with flame charts
- Search and highlight the same function across different paths
- Use reverse-call analysis to identify high-impact functions
If you're working on a Unity project where gameplay logic is generating CPU spikes or frame-time problems, these views can provide a faster way to move from "something is expensive" to "this function is the bottleneck, and these are the paths affecting performance."
GameOptim is continuing to improve its profiling and performance analysis workflow to make Unity performance optimization more practical for developers.
Top comments (0)