Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Clear old MEG models on entity to support reloading MEG component
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Feb 2, 2024
1 parent 695493f commit 93822df
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class SetModelEngineModelSystem : GearyListener() {
val blueprint =
ModelEngineAPI.getBlueprint(model.modelId) ?: error("No blueprint registered for ${model.modelId}")

// Clear any old models
modelEntity.models.toList().forEach { (key, value) ->
modelEntity.removeModel(key)
value.destroy()
}

val createdModel = ModelEngineAPI.createActiveModel(blueprint).apply {
if (model.damageTint) damageTint = Color.RED
val scale = model.scale.randomOrMin()
Expand Down Expand Up @@ -60,7 +66,6 @@ class SetModelEngineModelSystem : GearyListener() {
data.blockedCullIgnoreRadius = it.ignoreRadius
}
}

}
}
}
Expand Down

0 comments on commit 93822df

Please sign in to comment.