Unity ECS System Breaks After Namespace Change

165 views Asked by At

I just realized that my gameplay logic broke after some (allegedly) harmless refactoring changes.

Going through my VCS history and some debugging I fond out that the problem was caused by a namespace change for the system causing the issue.

What was weird is that the system still appeared to work, the sections updating Translation and Rotation of my entities were still called (as seen from break points / log messages), however, no of the changes were reflected in the rendering or the actual components.

1

There are 1 answers

0
Aides On

It turns out the change in namespace changed the order of the system in it's system group.

Specifically, the entity had a PhysicsBody component on it and my system that set the Translation and Rotation was put after the BuildPhysicsWorld system which apparently nullified the system writing to Translation and Rotation (the specific components and systems might vary in your case).

The solution is to specifically declare the order dependency with [UpdateBefore(typeof(BuildPhysicsWorld)] (or [UpdateAfter()] if appropriate).