Quick answer: Use UnsafeUtility.As<TFrom, TTo> for type punning. Avoid raw pointer cast across types.

Reinterpret a float* as int* for bit ops. Burst inspector warns of undefined behavior. Strict aliasing violation.

The Fix

using Unity.Collections.LowLevel.Unsafe;

[BurstCompile]
unsafe struct BitsJob : IJob {
    [NativeDisableUnsafePtrRestriction] public float* Data;
    public int Count;

    public void Execute() {
        for (int i = 0; i < Count; i++) {
            int bits = UnsafeUtility.As<float, int>(ref Data[i]);
            // safe legal type punning
        }
    }
}

UnsafeUtility.As is the legal alias path. Compiler knows; no UB.

Verifying

Burst inspector clean. Job executes correctly. Without As: warnings + potential codegen issues.

“UnsafeUtility.As. Legal puns.”

Related Issues

For Burst FunctionPointer, see FP. For Burst NoAlias, see NoAlias.

Use As. UB clear.