[860] Changing the animation with slider don't work
complete
j
javiermoreno15
the problem is that in vrchat that does not work now, the utilities of this are many, such as changing the weight of the postprocessed with a slider, or rotating objects with slider, this only occurs in vrchat, in unity it works correctly.
id of the testing world: https://vrchat.com/home/world/wrld_f6c2e33f-9552-4949-82e3-fc5b02197290
How does the system work: https://drive.google.com/file/d/1nPdNMcuvgysUgCvxxrxXfrhpao1l268F/view?usp=sharing
Log In
Tupper - VRChat Head of Community
complete
This should be totally fixed in 876. If you still see issues, please open a new item!
Tupper - VRChat Head of Community
This should be mostly fixed in the latest Open Beta build
Tupper - VRChat Head of Community
in progress
We're currently investigating and working on this issue and related issues.
If there are other trigger-related issues that are different enough from this to warrant a separate post, please make one!
Tupper - VRChat Head of Community
Unity states this was fixed in 2018.4.10f1. Is it possible for someone to verify?
Merlin
Tupper - VRChat Head of Community: The slider UI callback drawing was fixed in Unity 2018.4.11f1 so people can make sliders that hook dynamic float bindings in the editor again. But the sliders still do not work in game in the newest open beta VRChat 2019.3.3 build 871 running on Unity 2018.4.11f1 likely because of the issue with IL2CPP that I updated in the long comment below.
Aev
tracked
Aev
Merlin
Aev: Boop, update because I was being dumb about the reason here since I was incorrectly assuming the Quest client was built using IL2CPP and would have the same issues if this was due to IL2CPP. But the Quest client is apparently using Mono at the moment, so this is the first time IL2CPP has reared its head.
The UI issue ends up being unrelated to the issue at hand since it still functions fine as long as you can get the event bound properly. Unity marked the OnValueChanged event with a float argument as private in 2018 which had the side effect of breaking the UI for it. The slider UI issue is a UI problem which I was able to fix in my custom event editor with the same fix Unity did.
I made a project to test the issue and try to reproduce it, and it looks like this ends up being due to IL2CPP stripping unused functions as TCL also suspected.
Just wanted to correct myself on the point with the sliders since the UI issue is unrelated. Most stuff past this point I assume is already known/being worked on but is included for completeness.
My test scene consisted of a slider on a canvas setup to call Rebind() and Update() on an animator via OnValueChanged the color of the slider to red. This is what it is supposed to look like: https://i.imgur.com/7BYCTKb.mp4
If I put the slider in the scene normally, it works fine in editor play mode, Mono backend builds, and IL2CPP backend builds. However, if I package the slider into an asset bundle and load it through StreamingAssets at runtime, the IL2CPP build does not work. If I make a slider in the scene that is hidden, but calls the same Rebind() and Update() functions, then the IL2CPP build that loads the slider from StreamingAssets will work since IL2CPP know knows that the functions are used.
Most games will not run into issues like this when using IL2CPP since Unity will scan through UI events like the slider OnValueChanged callback to look at what functions they reference at build time of the client. This requires Unity to be aware of all the levels and content in those levels. In VRChat's case, you use asset bundles of content that other people make so the IL2CPP compiler can't know what functions they reference.
IL2CPP code stripping is likely what is also breaking player tracking v2 and other prefabs in worlds.
The IL2CPP code stripping only applies to builtin Unity types and external assemblies you import. So most things in the world whitelist such as standard asset scripts and FinalIK are not affected since they are part of the main assembly.
Unity provides a way to prevent stripping of methods, properties, fields, and events without needing to generate stubs via link.xml which is documented here: https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html
I added a basic link.xml to the root of the Assets folder that forces the IL2CPP compiler to include all of the functions on UnityEngine.Animator. This fixed the slider in my case and allowed me to use the slider in IL2CPP without including something that uses the functions on the animator.
This was the basic link.xml (with no indenting because I don't know how to make canny respect it):
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Animator" preserve="all"/>
</assembly>
</linker>
You’d probably want to add most of the builtin UnityEngine types in the world whitelist to link.xml to prevent worlds from breaking. But if there are specific functions on the whitelisted types that pose a concern you could preserve specific functions within a type, though you obviously can’t use those functions in the code base or Unity would re-add them.
The bytecode stripping documentation has more examples, but this is a version of link.xml that fixes the slider specifically without including the entirety of the Animator class as an example:
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Animator" preserve="nothing">
<method name="Update"/>
<method name="Rebind"/>
</type>
</assembly>
</linker>
Of course there are a lot of other functions on Animators and other whitelisted components that are used by worlds. So dropping down into the per-function preserving might want to be considered a blacklist within a whitelist to be used only when there’s a problematic function. Especially since you can easily accidentally end up breaking content that uses private functions which are usable using animation events on animations and via buttons using my Easy Event Editor editor script. An example of content that makes use of private functions to be usable is HardLight’s Player Tracking v2 and a lot of prefabs that manually call functions that will often be private like Update, LateUpdate, and Start to work properly.
When you’re adding types to preserve I’d request that you add the RenderTexture and CustomRenderTexture types to that list since more complex shader-based worlds such as SCRN’s “The Home Arcade” world call functions on those to have control over their update loops and bindings. The reason I ask for these specifically is because they are considered assets, and not components so they are not in the component whitelist for worlds and they may be missed, though they have been used in worlds for a while.
Here’s a link to the project files if you want to look at them. It has a thrown-together script to generate the asset bundles and load them for testing. This is made in 2018.4.10 since I couldn’t find 2018.4.9 with the IL2CPP compilation dependencies because of how Unity Hub acts. https://drive.google.com/file/d/1K1A1cxeHqVvGcY5sMyO3mvApOZPyU5NM/view?usp=sharing
Merlin
https://forum.unity.com/threads/slider-event-onvaluechanged-missing-parameter.746201/ related thread discussing this issue. Unity removed the float parameter from the OnValueChanged event on the Slider. This is apparently fixed in 2019.3.4 so Unity needs to port the fix back to 2018.4.x