1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2025-07-18 17:38:01 +08:00

Fixed enabled in BonesPanel, refactored SetMeshesEnabled to not use reflection and to disable meshes consistently with the BonesManager.

This commit is contained in:
originalnicodr
2024-06-20 18:52:25 -03:00
parent af2ad057fb
commit d2d22de66c
2 changed files with 3 additions and 4 deletions

View File

@ -145,13 +145,12 @@ namespace UnityExplorer.UI.Panels
}
public void SetMeshesEnabled(bool value){
PropertyInfo enabledProperty = typeof(SkinnedMeshRenderer).GetProperty("enabled");
foreach (SkinnedMeshRenderer skinnedMesh in skinnedMeshes) {
enabledProperty.SetValue(skinnedMesh, value, null);
skinnedMesh.TryCast<Renderer>().enabled = value;
}
foreach (MeshRenderer meshRenderer in extraMeshes) {
meshRenderer.enabled = value;
meshRenderer.gameObject.SetActive(value);
}
}
}

View File

@ -68,7 +68,7 @@ namespace UnityExplorer.UI.Panels
bone.localEulerAngles = CachedBonesTransform.angles;
bone.localScale = CachedBonesTransform.scale;
// We assume these were on before. If not we should save its state beforehand.
bone.gameObject.SetEnabled(true);
bone.gameObject.SetActive(true);
}
} else {
bonesOriginalState.Clear();