Answer the question
In order to leave comments, you need to log in
How to correctly handle clicking on a UI component in unity ECS?
I want to make a container with a list of playable characters. By clicking on the character, the character should become active.
Created a component containing a character and an activity flag:
public struct PartyCellComponent : IComponentData {
public PlayableCharacter playableCharacter;
public bool active;
}
[RequiresEntityConversion]
public class PlayerCellEntity : MonoBehaviour, IConvertGameObjectToEntity {
[SerializeField]private PlayableCharacter playableCharacter;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) {
var data = new PartyCellComponent {
playableCharacter = playableCharacter,
active = false
};
dstManager.AddComponentData(entity, data);
}
}
public class PartyCellSystem : ComponentSystem {
protected override void OnUpdate() {
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question