Unity-Technologies / ECS-Network-Racing-Sample

ECS multiplayer racing sample to showcase using Unity Entities and netcode with best practices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: why does the VehicleBaker exists?

oeN opened this issue Β· comments

Hi,

I'm trying to understand the code of this project (thanks for it btw 😊), and I have a question, why does the VehicleBaker system exists?

Is it only to pass the entity in the ChassisReference component, or for some other reasons that I'm missing?

var chassis = new ChassisReference { Value = entity };

Thanks

I think I've figured it out, in the VehicleBaking you should add components only to the vehicle entity.
Maybe CreateAdditionalEntity could be used for the wheels but it will result in a bit messy situation, so the VehicleBaker system exists to allow the wheels entity to be "populated" with the correct components all from one baker.

I suppose the LapProgress, Skin, PlayerName, Rank, and Reset could be added to the Vehicle inside the VehicleBaking.Bake() but having them in the same place as the other components is cleaner.

Sorry for the notifications that I've triggered 😬