microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6.01k stars 2.12k forks source link

Scrolling Object Collection - Near term improvements #9481

Closed cre8ivepark closed 3 years ago

cre8ivepark commented 3 years ago

Describe the bug

Scrolling Object Collection - aggregation of the reported issues

Grace Lee: there is a something going on with the material instancer. There are times it causes the front plates to go pink and sometimes it shuts off the mesh renderer for the highlight plates. the workout I had was to select all the highlight plates, remove the instancer, turn the mesh render back on and then reapply the material instancer. This issue might not have to do with the scrolling object collection tho cause the scrip that was being used was slightly custom but thought it might be worth mentioning

(Matt) I think the 'pink' issue is the material overflow - I always see this when hitting the 256th material in the SOC clipping frustum when testing content inside a SOC in editor time. The of materials is on ClippingBox related to: --ClippingBox array hits inspector cap for array size (255) - subsequent materials within the clipping frustum dont appear one other callout for MaterialInstance - this is hitting materials that are nominally disabled for example the HL1 FrontPlate material in the MRTK button templates gets toggled on by ClippingBox which results in "double" front plates as we only need the Highlight plate Hl2 version shown.

Long term improvements are now captured in #9518

cre8ivepark commented 3 years ago

I was able to repro the issue. Here is the example scene that shows pink material issue.

Branch:

https://github.com/cre8ivepark/MixedRealityToolkit-Unity/tree/SOC_PinkShader

Scene name:

Examples/Demos/ScrollingObjectCollection/Scenes/PinkShaderIssue.unity

Screen recording:

https://user-images.githubusercontent.com/13754172/112704846-58eb9600-8e59-11eb-95fd-7a1ccbf83218.mp4

Error messages

In this case, it seems it is related to TMP. However, I saw different errors for the objects that do not contain TMP. MissingReferenceException: The variable m_sharedMaterial of TextMeshPro doesn't exist anymore.

You probably need to reassign the m_sharedMaterial variable of the 'TextMeshPro' script in the inspector. TMPro.TextMeshPro.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_Private.cs:1969) TMPro.TextMeshPro.OnPreRenderObject () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_Private.cs:1549) TMPro.TextMeshPro.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TextMeshPro.cs:241) TMPro.TMP_UpdateManager.DoRebuilds () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_UpdateManager.cs:187) TMPro.TMP_UpdateManager.OnCameraPreCull (UnityEngine.Camera cam) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_UpdateManager.cs:158) UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) (at :0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)