Is managed data still needed?
See original GitHub issue@keenanwoodall Since latest versions of Unity support Mesh.SetVertices, Mesh.SetNormals, etc with native arrays I was wondering if we still need to do this step?
From MeshData.cs:
// Copy the native data into the managed data for efficient transfer into the actual mesh.
DataUtils.CopyNativeDataToManagedData(dynamicManaged, DynamicNative, dataFlags);
I have tried bypassing it and doing this instead and it works fine, I think it might be more efficient since we can skip the managed overhead entirely?
if ((dataFlags & DataFlags.Vertices) != 0)
DynamicMesh.SetVertices(DynamicNative.VertexBuffer);
if ((dataFlags & DataFlags.Normals) != 0)
DynamicMesh.SetNormals(DynamicNative.NormalBuffer);
if ((dataFlags & DataFlags.Tangents) != 0)
DynamicMesh.SetTangents(DynamicNative.TangentBuffer);
if ((dataFlags & DataFlags.UVs) != 0)
DynamicMesh.SetUVs(0,DynamicNative.UVBuffer);
if ((dataFlags & DataFlags.Colors) != 0)
DynamicMesh.SetColors(DynamicNative.ColorBuffer);
...etc...
If not then there is separate optimization I’d like to propose/implement that will be faster than MemCpy (see bottom of this page if curious: https://jacksondunstan.com/articles/4713 where CopyFromFast
and CopyToFast
is discussed)
Just want to get some thoughts on this in case I’m missing something, otherwise I’m thinking about stripping out the managed data stuff and submitting a pull request!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Do You Need a Managed Database?
But let's assume you do have the freedom to move your database to the cloud. Don't forget that someone is still going to...
Read more >Do we still need a data warehouse?
Yes, learning data warehousing is still relevant today because of its capability to integrate data, it is easy to use and because thousands...
Read more >What Is Data Management and Why Is It Important?
Effective data management is a crucial piece of deploying the IT systems that run business applications and provide analytical information to help drive ......
Read more >The data-driven enterprise of 2025
Though the proliferation of data is driven by unstructured or semi-structured data, most usable data is still organized in a structured ...
Read more >Understanding Managed Databases
A managed database service can ease the stress of deploying and maintaining a database, but there are still a few things to keep...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Preprocessor stuff has been added so it uses managed data before 2019.3 I made a test fbx with submeshes to see how it breaks and realized it wasn’t going to break because no deformer (that I’ve made) marks the triangles as changed in the data flags so it never gets copied.
I removed the data flags check so it always copies the triangles and the result was the first material being applied to the entire mesh since it was treated as one submesh. Was that how it broke for you, or did it do something else? Did you have a custom deformer that was modifying the triangles? I’m curious what caused the break.
I tried changing the code that sets the indices to this
it’s on develop and it seems to work as well 👍
Yea when I originally wrote this you couldn’t copy directly to the mesh from native collections. I’m glad the mesh API finally caught up! I just pushed the changes to develop. I think it should be stable, but like with other stuff I’ll sit on it a bit longer before merging.