Profiler.BeginSample doesn't work

I have a button that simply writes to a log, and does a Profiler.BeginSample (with an EndSample). I can see the log, but I don’t see the sample in the profiler. I have Development Build checked, and I’m experiencing this problem in the editor, in a stand-alone PC build, and on my iPad. I also have a #define ENABLE_PROFILER at the top of the script that calls BeginSample.

Why might this not be working, and what can I do to address it?

Thank you.

If you call a method once per button click which does something like…

public void OnClick()

Then you have to scrub back to the frame in the profiler to where the click happened (it won’t show up on any of the other frames). No, there’s no simple way of knowing when that happened unless you had a big spike there. The actual sample label will be nested within some method so you may have to dig around for it. Other than that I don’t think you have to do anything in the editor to see it.

If you were responding to an onClick callback from Unitys Button UI, it should be nested under BehaviourUpdate/EventSystem.Update(), as shown in the image below.