Minor fixes

This commit is contained in:
SDraw 2023-11-27 11:45:01 +03:00
parent aebf6c2c4e
commit 914bca26e4
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
14 changed files with 226 additions and 54 deletions

View file

@ -42,6 +42,10 @@ namespace ml_pmc
if(ms_instance == this)
ms_instance = null;
ModUi.CopySwitch -= this.OnTargetSelect;
if(m_localCopycat != null)
UnityEngine.Object.Destroy(m_localCopycat);
m_localCopycat = null;
}

View file

@ -33,15 +33,26 @@ namespace ml_pmc
HumanPose m_pose;
PuppetParser m_puppetParser = null;
internal PoseCopycat()
void Start()
{
if(Instance == null)
Instance = this;
}
~PoseCopycat()
void OnDestroy()
{
if(Instance == this)
Instance = null;
m_poseHandler?.Dispose();
m_poseHandler = null;
if(m_puppetParser != null)
Object.Destroy(m_puppetParser);
m_puppetParser = null;
m_animator = null;
m_vrIk = null;
m_lookAtIk = null;
}
// Unity events