How to stop editor assigning new uuid's to all nodes in prefab edit mode?

Hi friends. I’m using node uuid’s to save/load game state. When I edit a prefab in editor it assignes new uuid’s to all nodes in prefab. How can I prevent to give new uuid’s when I editted a prefab?

Everything is ok for scene files. Uuid change occurs only for prefabs.

It breaks my save system. I want nodes to have static uuid’s during all stages of development. If I edit prefabs and release update for game most of save data will be broken for users.

Thanks in advance.

Hey friends! @slackmoehrle @jare @Big_Bear
Sorry to bother you :frowning: I’ve tried to access original uuid’s in file after prefab loaded but couldn’t find a way.
Do you have any ideas to solve this issue?

Prefab does not save node uuid, it only saves fileId. Because every instantiated node will assign its new uuid, so we discard all uuids in prefab.
You should use fileId to track node stages. FileId is saved in node._prefab.fileId

Thanks for your reply.
Is it possible to modify engine or make an extension to save some sort of id’s or id-like data into prefab file? If there is an IPC message sent before prefab save operation etc?

There is no kind of IPC so far. Why you don’t use _prefab.fileId?

I have made a generic save/load system for my physics based game. It saves node states based on the uuid’s defined in editor. When I instantiated an object from prefab, yes all new nodes get new uuid’s but I need to identify each node in prefab asset and link them to instantiated ones. I can go with node hierarchi to identify them but having solid uuid’s for all child nodes in prefab asset will be better for future development.
Here is example prefab structure:

 Root Node
    - Child node with sprite
    - Child node with several components
         - Child-child node with sprite
         - Child-child node with some components
    - Child node with sprite etc..
         - Child-child node with several components

I’m not talking about after instantiated node in scene. I need to access prefab’s internal data before instantiate but there’s no uuid or something to identify all children nodes.

May be I can customize prefab save process or something?

Yeah, that’s what fileId used for. Use this code:

let uuidInPrefab = node._prefab.fileId;

The fileId is persistent between instantiation.

1 Like

Oh I understand now. Thank you for your time and patience :sweat_smile: :+1:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.