Animating Materials works in Preview, but not in Play/Runtime/VisonProSim etc

Have a problem with my Vision Pro test app. Not sure if it’s related to Polyspatial or not, or special project settings for the Vision Pro, but it works perfectly fine in a fresh URP project:

  1. I have a project with an animation which animates a material (eg. change cube from grey to red). This looks good in preview, but when I click play, the material does NOT animate in the Game window (but looks perfectly good in the preview window).

  2. To make this even more mysterious, when I start a fresh Unity project (URP), and do EXACTLY the same thing, it does work. But in my original project (also URP, but based off of one of the VisionPro Sample projects), it does not. There must be some kind of setting or so which I am missing and it’s probably really silly once I know what it is.

Attached are two video screenshots:

  1. My original video showing how the material animates correctly in preview but not in game

https://www.dropbox.com/scl/fi/ynbh…ting.mov?rlkey=7ifw3pfd07wilwtdqhe3macsf&dl=0

  1. A fresh project I created as a test where it works perfectly fine in both preview and in game

https://www.dropbox.com/scl/fi/je8p…ting.mov?rlkey=r5nn5603vi7xzlrby0ivnkwf1&dl=0

Any help would be much appreciated. I had this happen in the past when I tried to animate a materials transparency, but never figured out what it was.

Best,
H

There’s a known issue with animating material properties. The problem is basically that the animation system doesn’t flag the material as dirty, indicating that it should be re-transferred over PolySpatial. We plan to fix this eventually, but for now, a workaround may be to set some other material property to a new value every frame just to ensure that the material is re-transferred.

Thank you that worked as a workaround in the meantime.

1 Like

Hey guys,
Is there an ETA for the fix for animating material properties via the timeline?. Would it happen to be in the next release? We have a workaround fix at the moment (A script that force updates materials each frame), but this doesn’t work for all materials/shaders.
Thanks
Chris

This should be fixed as of 1.2.3/2.0.0-pre.3. It also required a Unity editor update, which means you have to use Unity 2022.3.26+ or 2023.2.20+.

using 22.3.30 and 1.2.3 and animating materials does not work

Upgraded to test this out, unfortunately materials still do not animate on the timeline on 2022.3.32f1, with Polyspatial 1.2.3.

Please submit a bug report and let us know the incident number (IN-#####) so that we can investigate. You may also be able to work around the issue by using PolySpatialObjectUtils.MarkDirty(Renderer) to mark the renderer with the animated material properties dirty every frame that the properties change.