public void ReplaceGameConfig(Configs.SO.GameConfig newValue) { var index = MetaComponentsLookup.GameConfig; var component = CreateComponent <GameConfigComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
public MetaEntity SetGameConfig(Configs.SO.GameConfig newValue) { if (hasGameConfig) { throw new Entitas.EntitasException("Could not set GameConfig!\n" + this + " already has an entity with GameConfigComponent!", "You should check if the context already has a gameConfigEntity before setting it or use context.ReplaceGameConfig()."); } var entity = CreateEntity(); entity.AddGameConfig(newValue); return(entity); }
public void ReplaceGameConfig(Configs.SO.GameConfig newValue) { var entity = gameConfigEntity; if (entity == null) { entity = SetGameConfig(newValue); } else { entity.ReplaceGameConfig(newValue); } }