Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeshSmoother not destroying original mesh #9307

Closed
edgar-rodrigo-santos opened this issue Feb 17, 2021 · 2 comments
Closed

MeshSmoother not destroying original mesh #9307

edgar-rodrigo-santos opened this issue Feb 17, 2021 · 2 comments
Labels
Feature Request Feature request from the community Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on

Comments

@edgar-rodrigo-santos
Copy link

Describe the problem

I am currently using the MeshSmoother together with the Outline shading using the MRTK2 shader. In our scenario, this needs to be done and undone programatically and leaving the original mesh untoched. It just so happens that when the MeshSmoother component is destroyed, its OnDestroy method wipes out the object mesh and I can't show the original object anymore.

Describe the solution you'd like

MeshSmoother.OnDestroy not having the desctructive behavior.

Describe alternatives you've considered

I have implemented a solution and I'll contribute it if you need to.
In broad strockes, when doing the "MeshReference" to count references to the mesh, I also keep the original "shared mesh" reference inside it. In the OnDestroy() method, in the case there's no more references to it (which is our case), on top of destroying the current mesh, I re-instantiate the original one: meshFilter.mesh = Instantiate(meshReference.InitialMesh);

Additional context

I realize that the smoothed normals are written to the UV2 channel and I might as well just keep them until the object is actually destroyed but I don't think the fix I suggested as any downsides and has the upside of being able to safely remove a MeshSmoother component without issues.

@edgar-rodrigo-santos edgar-rodrigo-santos added the Feature Request Feature request from the community label Feb 17, 2021
@mihaits
Copy link

mihaits commented Sep 23, 2021

I am also having this issue with runtime outline enabling/disabling. Another problem is that you can't use MeshOutlineHierarchy if you want to disable outlines since it can only be destroyed. It doesn't implement OnEnable/OnDisable.
My workaround is to disable MeshOutline components instead of destroying them.

@IssueSyncBot
Copy link
Collaborator

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!

@IssueSyncBot IssueSyncBot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2024
@IssueSyncBot IssueSyncBot added the Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Feature request from the community Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on
Projects
None yet
Development

No branches or pull requests

4 participants