If a node is added to the scene with a zero ID (default), assign an ID. This would happen when constructing a node manually and adding it using AddChild(), instead of using CreateChild().