The BurstDiscard attribute lets you remove a method or property from being compiled to native code by the burst compiler.
By default, a job compiled with burst will compile all methods. In some cases, you could have managed methods that cannot be compiled to native (e.g checking for validity only valid in a managed environment or logging using managed objects...etc) and should not be executed at runtime. In that case you can use this attribute to mark a method or property as not compilable by the burst compiler.
no example available in JavaScript
using Unity.Burst; using Unity.Collections; using Unity.Jobs; using UnityEngine;
public struct MyJob : IJob { // ...
[BurstDiscard] public void NotExecutedInNative() { Debug.Log("This is a log from a managed job"); }
public void Execute() { // The following method call will not be compiled NotExecutedInNative(); } }