unsafe drag drop test
- unsafe because of entity reference - unsafe because of unsafe code lol - fixes in parent/child system
This commit is contained in:
@ -28,10 +28,7 @@ namespace Nerfed.Runtime.Util
|
||||
// Relation goes from child to parent.
|
||||
public static void SetParent(in World world, in Entity child, in Entity parent)
|
||||
{
|
||||
if (world.Related<ChildParentRelation>(parent, child))
|
||||
{
|
||||
RemoveParent(world, parent);
|
||||
}
|
||||
RemoveParent(world, child);
|
||||
|
||||
world.Relate(child, parent, new ChildParentRelation());
|
||||
world.Set(child, new Child());
|
||||
@ -47,8 +44,10 @@ namespace Nerfed.Runtime.Util
|
||||
return;
|
||||
}
|
||||
|
||||
Entity parent = world.OutRelationSingleton<ChildParentRelation>(child);
|
||||
|
||||
// TODO: Check if Unrelate all also unrelates incomming relations..?
|
||||
world.UnrelateAll<ChildParentRelation>(child);
|
||||
world.Unrelate<ChildParentRelation>(child, parent);
|
||||
world.Remove<Child>(child);
|
||||
world.Set(child, new Root());
|
||||
}
|
||||
|
Reference in New Issue
Block a user