globalobjectid
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
globalobjectid [2021/02/08 09:12] – uninomiconadmin | globalobjectid [2025/01/15 04:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 9: | Line 9: | ||
//All notes below only apply to running the game in Play mode in the Editor.// | //All notes below only apply to running the game in Play mode in the Editor.// | ||
- | When a scene is loaded in play mode, prefabs are unpacked ((I've seen this mentioned in the profiler as Prefabs.MergePrefabs, | + | When a scene is loaded in play mode, prefabs are unpacked ((I've seen this mentioned in the profiler as Prefabs.MergePrefabs, |
For example. You may have a prefab in the scene with GID: | For example. You may have a prefab in the scene with GID: | ||
Line 29: | Line 29: | ||
'' | '' | ||
- | <codedoc c#> | + | ++++ Example Code| |
+ | |||
+ | <code csharp> | ||
private static GlobalObjectId ConvertPrefabGidToUnpackedGid(GlobalObjectId id) | private static GlobalObjectId ConvertPrefabGidToUnpackedGid(GlobalObjectId id) | ||
- | | + | { |
- | ulong fileId = (id.targetObjectId ^ id.targetPrefabId) & 0x7fffffffffffffff; | + | ulong fileId = (id.targetObjectId ^ id.targetPrefabId) & 0x7fffffffffffffff; |
- | bool success = GlobalObjectId.TryParse( | + | bool success = GlobalObjectId.TryParse( |
- | $" | + | $" |
- | out GlobalObjectId unpackedGid); | + | out GlobalObjectId unpackedGid); |
- | Assert.IsTrue(success); | + | Assert.IsTrue(success); |
- | return unpackedGid; | + | return unpackedGid; |
- | } | + | } |
- | </codedoc> | + | </code> |
+ | |||
+ | ++++ | ||
+ | |||
+ | ===== Bug: Querying deleted objects ===== | ||
+ | When calling '' | ||
+ | |||
+ | For example, in this case, when passed an array of only scene objects: | ||
+ | {{ : | ||
+ | |||
+ | The function will return non-scene objects (the shader editor asset at 205). | ||
+ | {{ : | ||
+ | |||
+ | This seems to be a bug. The correct result should have been '' | ||
+ | |||
+ | I have had some luck < | ||
+ | Update: This is fixed in 2021.1 [[https:// | ||
globalobjectid.1612775528.txt.gz · Last modified: 2025/01/15 04:35 (external edit)