Not able to Burst a Function.
public static class C
{
public const float Epsilon = 0.0001f;
[BurstCompile]
public static bool _isEqualToForBurst(float2 A, float2 B)
{
if ((A.x - B.x < Epsilon) && (A.y - B.y < Epsilon))
return true;
else
return false;
}
}
var burstedFloat2IsEqual = BurstCompiler.CompileFunctionPointer<Func<float2,float2,bool>>( C._isEqualToForBurst);
Error 1:
Unexpected exception Burst.Compiler.IL.Helpers.MethodDecoderException: Unable to decode C, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::_isEqualToForBurst(Unity.Mathematics.float2, Unity.Mathematics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|Unity.Mathematics.float2, Unity.Mathematics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) —> Burst.Compiler.IL.Helpers.MethodDecoderException: Unable to decode method after C, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::
at Burst.Compiler.IL.Helpers.CecilInterop+MethodParser.DecodeMethodName () [0x00037] in <2c9ff9fb581642acaeb86844246ad423>:0
at Burst.Compiler.IL.Helpers.CecilInterop+MethodParser.DecodeMethod () [0x00027] in <2c9ff9fb581642acaeb86844246ad423>:0
at Burst.Compiler.IL.Helpers.CecilInterop.DecodeMethodFromString (System.String fullMethodName) [0x00017] in <2c9ff9fb581642acaeb86844246ad423>:0
— End of inner exception stack trace —
at Burst.Compiler.IL.Helpers.CecilInterop.DecodeMethodFromString (System.String fullMethodName) [0x00033] in <2c9ff9fb581642acaeb86844246ad423>:0
at Burst.Compiler.IL.Jit.JitCompilerService.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job) [0x001ba] in <2c9ff9fb581642acaeb86844246ad423>:0
Error 2:
InvalidOperationException: Burst failed to compile the given delegate: Boolean _isEqualToForBurst(Unity.Mathematics.float2, Unity.Mathematics.float2)
attribute: Unity.Burst.BurstCompileAttribute
Unity.Burst.BurstCompiler.Compile[T] (T delegateObj) (at Library/PackageCache/com.unity.burst@1.1.1/Runtime/BurstCompiler.cs:120)
Unity.Burst.BurstCompiler.CompileFunctionPointer[T] (T delegateMethod) (at Library/PackageCache/com.unity.burst@1.1.1/Runtime/BurstCompiler.cs:78)
CWBR.Client.Systems.PlayersAnimationsSystem.OnCreate () (at Assets/Scripts/ECS/Systems/ClientSideOnly/PlayersAnimationsSystem.cs:49)
Unity.Entities.ComponentSystemBase.CreateInstance (Unity.Entities.World world) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities/ComponentSystem.cs:189)
Unity.Entities.World.AddSystem[T] (T system) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities/World.cs:341)
Unity.Entities.World.CreateSystemInternal (System.Type type, System.Object[ ] constructorArguments) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities/World.cs:235)
Unity.Entities.World.GetOrCreateSystemInternal (System.Type type) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities/World.cs:251)
Unity.Entities.World.GetOrCreateSystem (System.Type type) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities/World.cs:279)
Unity.Entities.DefaultWorldInitialization.GetOrCreateManagerAndLogException (Unity.Entities.World world, System.Type type) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:42)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities/Stubs/Unity/Debug.cs:25)
Unity.Entities.DefaultWorldInitialization:GetOrCreateManagerAndLogException(World, Type) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:46)
Unity.Entities.DefaultWorldInitialization:Initialize(String, Boolean) (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:119)
Unity.Entities.AutomaticWorldBootstrap:Initialize() (at Library/PackageCache/com.unity.entities@0.1.0-preview/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:15)