Skip to content

Add OnBeforeDisposeVolatileData method#43

Open
brnkhy wants to merge 2 commits intoUnity-Technologies:mainfrom
brnkhy:AddDisposeVolatileDataEvent
Open

Add OnBeforeDisposeVolatileData method#43
brnkhy wants to merge 2 commits intoUnity-Technologies:mainfrom
brnkhy:AddDisposeVolatileDataEvent

Conversation

@brnkhy
Copy link

@brnkhy brnkhy commented Mar 19, 2026

I was working on adding support to read custom vertex attributes for vertices as an add-on and if I understand the structure correct, I need the buffer information before it got disposed, to be able to read data. This method fires after data is loaded but before it's disposed.
About the usage; I have a custom GltfImport class, which overrides this new OnBeforeDisposeVolatileData method, then uses GetImportAddonInstance method to find my custom add-on and class a OnLoadCompleted method in it. Add-on uses accessor data, decodes it and caches the colors. later when OnMeshAdded is called, it applies the extracted data to the mesh.
Can't say I extensively tested my add-on and system built on top of this but it seems to work fine so far. I can also share those if you want to examine the use-case but they are not included into the PR of course.

brnkhy added 2 commits March 19, 2026 15:19
add OnBeforeDisposeVolatileData virtual method to support extensibility in gltfimport subclasses
remove dictionary parameter OnBeforeDisposeVolatileData as subclasses can get addons using GetImportAddonInstance method
@cla-assistant-unity
Copy link

cla-assistant-unity bot commented Mar 19, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant