What #if ENABLE_BURST_AOT
does?
Does it checks, if burst is enabled? What AOT stands for?
How I could use #if directive, to check if burst is enabled, or not?
I’m not sure exactly how it works with burst, but AOT stands for Ahead Of Time. So presumably it decides whether the burst compiler compiles everything straight away or if it waits until the execution is trying to invoke the code.
I don’t think you can. The code is compiled by the C# compiler which has no information about burst. After compilation nothing is left of #if
. Activating/deactivating burst does not trigger a recompile.
I don’t know if this actually is your problem: One way to branch based on burst is using BurstDiscard
with a ref
attribute.
void DoSomething()
{
var isUsingBurst = true;
CheckBurst(ref isUsingBurst);
if (isUsingBurst)
{
// burst
}
else
{
// non burst
}
}
[BurstDiscard]
static void CheckBurst(ref bool isUsingBurst)
{
isUsingBurst = false;
}
Interesting,
We use already [BurstDiscard] on our doggy method, which is used for debugging, but somehow doesn’t resolve our issue.
We try to track, where the issue is coming from.
And technically should work.
Interesting x2
@Mockarutan thx for AOT explanation.
Somehow, #if ENABLE_BURST_AOT seems skips / resolves the issue of the doggy method. But on other hand, I don’t want to use it, if not understanding, what is exactly doing, even if we used for debugging only.
Thx guys with responses so far.