unrust_inbuilt/
parent.rs

1use bevy::prelude::*;
2use genco::prelude::*;
3use unrust_proc_macro::unity_authoring;
4
5#[unity_authoring]
6pub struct UnityParent {
7    pub entity: u64,
8}
9
10impl From<Entity> for UnityParent {
11    fn from(value: Entity) -> Self {
12        UnityParent {
13            entity: value.to_bits(),
14        }
15    }
16}
17
18impl From<&UnityParent> for Entity {
19    fn from(value: &UnityParent) -> Self {
20        Self::from_bits(value.entity)
21    }
22}
23
24impl From<UnityParent> for Entity {
25    fn from(value: UnityParent) -> Self {
26        Self::from_bits(value.entity)
27    }
28}
29
30#[allow(non_snake_case)]
31pub fn UnityParent_ingest_component(entity: &mut bevy::ecs::world::EntityMut, val: &UnityParent) {
32    entity.set_parent(val.into());
33    entity.insert(*val);
34}
35
36#[allow(non_snake_case)]
37pub fn UnityParent_CSHARP_TOKEN() -> csharp::Tokens {
38    quote! {
39        [StructLayout(LayoutKind.Sequential)]
40        public unsafe struct UnityParent
41        {
42            public ulong parent;
43        }
44    }
45}