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
6k stars 2.12k forks source link

StateViz AnimationEffect - DrawIf property exception spam #11436

Closed holomatt closed 1 year ago

holomatt commented 1 year ago

This issue has been migrated a new MRTK repository, and the status of this issue will now be tracked at the following location:


Describe the bug

PR: https://github.com/microsoft/MixedRealityToolkit-Unity/pull/11438

Console spams exceptions while interacting with StateViz while an Animation type effect is attached.

DrawIf operates on the object being serialized. In this case, we have a StateVisualizer that is being serialized, which contains a simple serializable class: AnimationEffect. AnimationEffect makes use of 'drawif' referencing one of its members, but AnimationEffect is not a monobehavior and will only ever be serialized in the context of another object. In this case, StateVisualizer. When the DrawIf attribute code is invoked, it looks for the specified property name (weightMode) on the object being serialized (a StateVisualizer) and throws an error because that doesn't exist.

To reproduce

  1. Add PressableButton to a GameObject
  2. Add StateViz to the same GameObject
  3. Add Animation effect type to any StateViz outlet

Observed behavior

Console spams exception:

DrawIfAttribute couldn't find the SerializedProperty to compare against! (property name: weightMode)

Expected behavior

No exception spam.

Screenshots

If applicable, add screenshots to help explain your problem.

Your setup (please complete the following information)

AMollis commented 1 year ago

Fixed with this pull request