Friflo.Json.Fliox icon indicating copy to clipboard operation
Friflo.Json.Fliox copied to clipboard

FieldQuery.TraverseMembers leads stackoverflow

Open vkensou opened this issue 1 year ago • 2 comments

I make a component in unity, like:

    public struct CompA : IComponent
    {
        public float2 goalLS;
    }

the float2 is Unity.Mathematics.float2:

struct float2
{
    public float3 xyz{get;set;}
};
struct float3
{
    public float2 xy{get;set;}
};

vkensou avatar Nov 27 '24 07:11 vkensou

The type declarations using float2 and float3 does not compile in C#. Compiler error: Error CS0523 : Struct member 'float2.xyz' of type 'float3' causes a cycle in the struct layout

See: https://github.com/friflo/Friflo.Engine.ECS/blob/main/src/Tests/ECS/Github/Test_GitHub_56.cs

  • Are you using these types in Unity?
  • Does Unity compile this successful? Even Unity must not allow to compile this.

friflo avatar Nov 27 '24 08:11 friflo

The type declarations using float2 and float3 does not compile in C#. Compiler error: Error CS0523 : Struct member 'float2.xyz' of type 'float3' causes a cycle in the struct layout

See: https://github.com/friflo/Friflo.Engine.ECS/blob/main/src/Tests/ECS/Github/Test_GitHub_56.cs

  • Are you using these types in Unity?
  • Does Unity compile this successful? Even Unity must not allow to compile this.

Yes, I am using unity. the float2 and float3 are from Unity package: Unity.Mathematics actually.

vkensou avatar Nov 29 '24 02:11 vkensou