Search Unity

Can I use static utility class method in a job for Burst Compile?

Discussion in 'Data Oriented Technology Stack' started by Kichang-Kim, Dec 17, 2018.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    277
    Hi, I have a question about static utility class method availability for Job and Burst Compiler.

    For a complex math calculation, I created utility class for SomeUtility. It have SomeCaculationMethod(float3 p0, float3 p1, out float3 result0, out float3 result1) for example. (it return multiple result variables by out paramter)

    Can I use this class in a job and is it optimized by burst compiler?

    Code (CSharp):
    1. [BurstCompile]
    2. struct SomeJob : IJob
    3. {
    4.     public void Execute()
    5.     {
    6.         SomeUtility.SomeCalculation( ... );
    7.     }
    8. }
    Thanks.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,565
    Yes as long as you're not accessing static data within the method.
     
    Kichang-Kim likes this.