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.

Bug Cannot use Unity.Mathematics types in custom VFXType

Discussion in 'Visual Effect Graph' started by spajus, Aug 29, 2022.

  1. spajus

    spajus

    Joined:
    Jun 10, 2015
    Posts:
    38
    Code (CSharp):
    1. using Unity.Mathematics;
    2. using UnityEngine;
    3. using UnityEngine.VFX;
    4. namespace Game.VFXR {
    5.     [VFXType(VFXTypeAttribute.Usage.GraphicsBuffer), StructLayout(LayoutKind.Sequential)]
    6.     public struct VFXRSpriteData {
    7.         public float3 Pos;
    8.         ...
    9.     }
    10. }
    11.  
    Trying to compile this gives the following error:


    Error while processing VFXType
    The type Unity.Mathematics.float3 doesn't use the expected [VFXType] attribute.
    The field 'Pos' (Unity.Mathematics.float3) in type 'Game.VFXR.VFXRSpriteData' isn't valid.


    Does that mean that the new and shiny Visual Effect Graph cannot use the new and shiny Unity.Mathematics types, and we are forced to use the old Vector3 and friends? With all the boxing involved if everything else is float3?
     
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    284
    Hello! You are right, this is an oversight from our side. As VFX Graph package has no dependency on mathematics, it was not considered. But I don't see any technical limitation that would prevent us to support mathematics types. Would you mind filing an issue so that it can be tracked and processed faster on our side?
     
  3. spajus

    spajus

    Joined:
    Jun 10, 2015
    Posts:
    38
    Sure, created a ticket:
    IN-15274
     
  4. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    284
    Thanks a lot