Skip to content

Commit

Permalink
zzre: Fix exception on rendering actor parts without alive parent entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Helco committed Jan 21, 2024
1 parent 8200f0b commit ac90b67
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zzre/game/systems/ActorRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ protected override void PreUpdate(CommandList cl)

[Update]
private void Update(CommandList cl,
in components.Parent parent,
in DefaultEcs.Entity entity,
in ClumpMesh clumpMesh,
in ModelMaterial[] materials)
{
var actorExResource = parent.Entity.Get<DefaultEcs.Resource.ManagedResource<string, ActorExDescription>>();
cl.PushDebugGroup(actorExResource.Info);
var actorExResource = entity.TryGet<components.Parent>(out var parent) && parent.Entity.IsAlive
? parent.Entity.Get<DefaultEcs.Resource.ManagedResource<string, ActorExDescription>>()
: default;
cl.PushDebugGroup(actorExResource.Info ?? "Unknown Actor");
materials.First().ApplyAttributes(cl, clumpMesh);
cl.SetIndexBuffer(clumpMesh.IndexBuffer, clumpMesh.IndexFormat);
foreach (var subMesh in clumpMesh.SubMeshes)
Expand Down

0 comments on commit ac90b67

Please sign in to comment.