Bool in iComponent data

Since bool is not bitable is there some class i can use in unity i can use or do i have to make my own class to do it?

make your own my man

No official solution at the moment (they will provide one, as they provided one in the past, but they will replace it apparently), in the mean time you can use something like this: PropertyDrawer for replacement of bool field

You can use an empty component as a tag. For example

public struct Dead:IComponent {

}

So if you need a component with “true” value you filter entities with this component, and if you want “false” value you filter entities without this component

struct Dead {

public ComponentDataArray<Dead> IsDead;
}

struct NotDead {

public SubtractiveComponent<Dead> IsNotDead;
}
1 Like

In many cases you can just use an int. 0 = false and 1 = true.