1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use genco::prelude::*;
use unrust_proc_macro::unity_authoring;

#[unity_authoring]
pub struct UnityGUID {
    pub hash: [u32; 4],
}

#[allow(non_snake_case)]
pub fn UnityGUID_ingest_component(entity: &mut bevy::ecs::world::EntityMut, val: &UnityGUID) {
    entity.insert(*val);
}

#[allow(non_snake_case)]
pub fn UnityGUID_CSHARP_TOKEN() -> csharp::Tokens {
    quote! {
        [StructLayout(LayoutKind.Sequential)]
        public unsafe struct UnityGUID
        {
            public fixed uint hash[4];

            public static implicit operator Unity.Entities.Serialization.EntityPrefabReference(UnityGUID val) => new Unity.Entities.Serialization.EntityPrefabReference(new Unity.Entities.Hash128(val.hash[0], val.hash[1], val.hash[2], val.hash[3]));

            public static implicit operator UnityGUID(Unity.Entities.Serialization.EntityPrefabReference val)
            {
                var guid = new UnityGUID();
                var hashes = val.AssetGUID.Value;
                guid.hash[0] = hashes[0];
                guid.hash[1] = hashes[1];
                guid.hash[2] = hashes[2];
                guid.hash[3] = hashes[3];
                return guid;
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        public unsafe struct UnityPrefab
        {
            public int ResourceID;
            public UnityEntity* Guid;
            public nuint Length;
        }
    }
}