{"record":{"id":"d5df4a71cd845c80","repo":"FyroxEngine/Fyrox","slug":"node-instance-have-different-type-than-i","errorCode":null,"errorMessage":"Node {}({}:{}) instance have different type than in the respective parent asset {}. The type will be fixed.","messagePattern":"Node (.+?)\\((.+?):(.+?)\\) instance have different type than in the respective parent asset (.+?)\\. The type will be fixed\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"fyrox-graph/src/lib.rs","lineNumber":1410,"sourceCode":"                            // Use original handle directly.\n                            resource_graph\n                                .try_get_node(node.original_handle_in_resource())\n                                .map(|resource_node| {\n                                    (resource_node, node.original_handle_in_resource())\n                                })\n                                .ok()\n                        }\n                    };\n\n                    if let Some((resource_node, original)) = resource_node {\n                        node.set_original_handle_in_resource(original);\n\n                        before_inherit(resource_node, node);\n\n                        // Check if the actual node types (this and parent's) are equal, and if not - copy the\n                        // node and replace its base.\n                        if node.inner_ref().type_id() != resource_node.inner_ref().type_id() {\n                            Log::warn(format!(\n                                \"Node {}({}:{}) instance \\\n                                        have different type than in the respective parent \\\n                                        asset {}. The type will be fixed.\",\n                                node.name(),\n                                node.self_handle().index(),\n                                node.self_handle().generation(),\n                                model_kind\n                            ));\n\n                            let base = node.base().clone();\n                            let mut resource_node_clone = resource_node.clone();\n                            variable::mark_inheritable_properties_non_modified(\n                                &mut resource_node_clone as &mut dyn Reflect,\n                                &ignored_types,\n                            );\n                            resource_node_clone.set_base(base);\n                            *node = resource_node_clone;\n                        }","sourceCodeStart":1392,"sourceCodeEnd":1428,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-graph/src/lib.rs#L1392-L1428","documentation":"In restore_original_handles_and_inherit_properties, each instance node is compared by type_id with its corresponding resource node. If they differ (the prefab's node type was changed, e.g. a Mesh became a Sprites node or a custom node version changed), this warning is logged and the node is copied from the resource so the type is corrected.","triggerScenarios":"A node's type in the parent asset no longer matches the instantiated node's type during scene-resource sync — typically after editing the prefab and changing node kind, or after code changes altered a custom node type.","commonSituations":"Developer replaces a node type in a prefab (e.g. swaps Rectangle for Sprite); refactor renames/re-types a user node class; engine version changed default node types in saved scenes.","solutions":["No action needed if intentional: the engine auto-fixes the type by copying the resource node (overrides may be lost).","Reapply instance-specific overrides after the fix, since the replacement resets inherited state.","If unintentional, revert the prefab node type to match existing instances.","Update custom node serialization when refactoring node types to keep saved scenes loadable."],"exampleFix":"// before\n// prefab: base = \"Mesh\", instance created earlier as \"Sprite\"\n// after\n// align types: set prefab node base to Sprite, or delete stale instances and re-instantiate the prefab","handlingStrategy":"fallback","validationCode":"// compare types before sync\nfn type_matches(node: &Node, res_node: &Node) -> bool {\n    node.inner_ref().type_id() == res_node.inner_ref().type_id()\n}","typeGuard":"fn same_type(a: &dyn Reflect, b: &dyn Reflect) -> bool { a.type_id() == b.type_id() }","tryCatchPattern":"if !type_matches(&node, &res_node) {\n    log::warn!(\"type differs for {}; engine will replace it; reapply overrides after sync\", node.name());\n}","preventionTips":["Avoid changing node base types in prefabs with live instances","Apply instance overrides via inheritable properties so they survive type fixes","Test scene load after every prefab type change","Keep custom node types stable or provide deserialization migrations"],"tags":["graph","type-mismatch","prefab","sync"],"backgroundTag":"node-type-mismatch","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}