Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Burst error BC1064, Why float3 is unsupported

Discussion in 'Burst' started by yifanchu183, Feb 12, 2023.

  1. yifanchu183

    yifanchu183

    Joined:
    Jul 4, 2019
    Posts:
    41
    Burst error BC1064: Unsupported parameter `Unity.Mathematics.float3` `pivot` in function `DestructionSystem.rotateAroundPoint(Unity.Mathematics.float3 pivot, Unity.Mathematics.quaternion targetRotation, Unity.Mathematics.float3 itemPosition, Unity.Mathematics.quaternion itemRotation, ref Unity.Mathematics.float3 finalPostion, ref Unity.Mathematics.quaternion finalRotation)`: structs cannot be passed to or returned from external functions in burst. To fix this issue, use a reference or pointer.
     
  2. yifanchu183

    yifanchu183

    Joined:
    Jul 4, 2019
    Posts:
    41
    Unity.Mathematics.quaternion is same error, so what is the correct usage of the float3 and quaternion in static method with [BurstCompile]
     
  3. vectorized-runner

    vectorized-runner

    Joined:
    Jan 22, 2018
    Posts:
    383
    Pass your data by 'ref' or 'in', or use Jobs
     
  4. yifanchu183

    yifanchu183

    Joined:
    Jul 4, 2019
    Posts:
    41
    yeah, it works. But I hope I can use it like 'float', don't need to use 'ref' at all.
     
  5. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    282
    You don't really lose much if you specify "in" for the struct parameters, just a change from copying the structs to getting a pointer to the value in the stack or a compiler-generated temporary variable when necessary. You don't even need to specify "in" when calling the methods if you don't have other by-value overloads that would be prioritized.