Baking Scene Object Network IDs

Quick question.

The client and the server will need a way to differentiate existing scene objects between each other, for example doors on a building. When should these IDs get baked?

Currently I just have an editor script that goes through every scene object, checks if it contains my network class, writes an ID to it and then saves the scene. Performance-wise, is it fine to run this on the EditorApplication.hierarchyChanged event? Or should I be doing this a different way?

Any feedback is appreciated.

Hi, what network framework are you using?

I’m building one :slight_smile:

I think I found my answer after a few hours of digging last night. It seems that PostProcessSceneAttribute is where this should be done, since it gets called at the start of editor play mode, and right before a build.

For anyone in the future confused about PostProcessSceneAttribute, When you assign a value to a scene object’s class during this phase, the values get baked into the build itself, and NOT the editor as well. Took me a while to figure out what was happening since the docs don’t mention anything about this.

1 Like