Руки одержимого: скрипты префаба снимаются до включения (зависание игры на ~)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-13 16:01:14 +03:00
co-authored by Claude Opus 5.5
parent 82aa8f0054
commit cfcd9d33a5
3 changed files with 18 additions and 0 deletions
+18
View File
@@ -108,8 +108,26 @@ namespace NecromancerTome
SDCSUtils.tmpAssetsOwner = wasOwner; SDCSUtils.tmpAssetsOwner = wasOwner;
} }
_rig.transform.SetLocalPositionAndRotation(Offset, Quaternion.identity); _rig.transform.SetLocalPositionAndRotation(Offset, Quaternion.identity);
// Скрипты префаба (vp_FPWeapon, риг IK и др.) рассчитаны на руки персонажа: включённая копия с ними повесила
// игру (тест 13.10: «прожал ~ и всё зависло», лог - vp_FPWeapon «Could not find CharacterController»).
// Рукам хватает скелета, аниматора и сетки - скрипты снимаем до включения.
// С конца и в два прохода: скрипт, от которого зависит другой ([RequireComponent]), снимется вторым.
int stripped = 0;
for (int pass = 0; pass < 2; pass++)
{
MonoBehaviour[] mbs = _rig.GetComponentsInChildren<MonoBehaviour>(true);
for (int i = mbs.Length - 1; i >= 0; i--)
{
if (mbs[i] != null)
{
Object.DestroyImmediate(mbs[i]);
stripped++;
}
}
}
// Префаб рук выключен: у персонажа его включает BodyAnimator (State = Visible) - тест 13.10: «активны False». // Префаб рук выключен: у персонажа его включает BodyAnimator (State = Visible) - тест 13.10: «активны False».
_rig.SetActive(true); _rig.SetActive(true);
Debug.Log("[NecromancerTome] FpArms: снято скриптов " + stripped);
_rig.name = "necroZombieArmsFP"; _rig.name = "necroZombieArmsFP";
int layer = LayerMask.NameToLayer("HoldingItem"); int layer = LayerMask.NameToLayer("HoldingItem");
int tinted = 0; int tinted = 0;
Binary file not shown.
Binary file not shown.