mirror of
https://github.com/originalnicodr/CinematicUnityExplorer.git
synced 2026-10-11 18:08:05 +08:00
Refactored the Animator pause to use start and stop playback (since disabling the whole animator could cause problems in some games). I am still disabling the animator as a fallback if the described method doesn't work.
This commit is contained in:
1 parent
147b846995
commit
336373169a
2 files changed
+28
-2
No files matched your search
@@ -103,7 +103,20 @@ namespace UnityExplorer.UI.Panels
|
||||
// We gotta do this for the animators which cell are not being currently rendered.
|
||||
foreach (Animator animator in animators){
|
||||
if (!shouldIgnoreMasterToggle[animator]){
|
||||
animator.enabled = enable;
|
||||
try {
|
||||
Type animatorClass = ReflectionUtility.GetTypeByName("UnityEngine.Animator");
|
||||
if (enable) {
|
||||
MethodInfo stopPlayBack = animatorClass.GetMethod("StopPlayback");
|
||||
stopPlayBack.Invoke(animator.TryCast(), null);
|
||||
} else {
|
||||
MethodInfo startPlayBack = animatorClass.GetMethod("StartPlayback");
|
||||
startPlayBack.Invoke(animator.TryCast(), null);
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// Fallback in case reflection isn't working
|
||||
animator.enabled = enable;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user