ARTICLE AD BOX
When using UnityEngine.Profiling, we can sample parts of our code in order to understand how much time and space they take up whilst running, like so:
using UnityEngine.Profiling; public class MyClass { void MyMethodA() { Profiler.BeginSample("MyClass.MyMethodA"); // Code here Profiler.EndSample(); } void MyMethodB() { Profiler.BeginSample("MyClass.MyMethodB"); // Code here Profiler.EndSample(); } void MyMethodC() { Profiler.BeginSample("MyClass.MyMethodC"); // Code here Profiler.EndSample(); } // ... and so on. }Here, in this class, I've aptly tied Profiler samples to each of my methods so that I can analyze them.
Writing Profiler.BeginSample and Profiler.EndSample all the time gets a little tedious in my opinion, once we start to write lots of methods.
In a particular class, I want every method to be profiled in the format above. I wonder if it is somehow possible to instead specify something in the code in only a few lines which then tells Unity to create samples for every method in my class like this, without me having to specifically write them all out.
Is this doable?
N.B. This is related to, but not quite the same as, this other question from me.
