public void ReleaseModel() { if (live2DModel != null) { live2DModel.releaseModel(); live2DModel = null; } }
private void OnDestroy() { //Live2D.dispose(); if (live2DModel != null) { live2DModel.releaseModel(); } }
public Texture ChangeCharacter(int MstID, bool isDamaged, int DeckID) { motionMgr.stopAllMotions(); int resourceMstId = Utils.GetResourceMstId(MstID); string path = "Live2D/" + resourceMstId + "/" + resourceMstId + ".moc"; TextAsset x = Resources.Load(path) as TextAsset; if (x != null && !isDamaged) { mocFile = x; for (int i = 0; i < 4; i++) { if (textureFiles[i] != null) { Resources.UnloadAsset(textureFiles[i]); } textureFiles[i] = null; textureFiles[i] = Resources.Load <Texture2D>("Live2D/" + resourceMstId + "/texture_0" + i); } NowMstID = MstID; motionFile = (ResourceManager.LoadResourceOrAssetBundle("Live2D/" + resourceMstId + "/" + resourceMstId + "_loop.mtn") as TextAsset); setModel(null); isDrawed = false; Play(); isLive2DChange = ((!isLive2DModel) ? true : false); isLive2DModel = true; return(myCamera.targetTexture); } int texNum = (!isDamaged) ? 9 : 10; isLive2DChange = (isLive2DModel ? true : false); isLive2DModel = false; if (live2DModelUnity != null) { live2DModelUnity.releaseModel(); live2DModelUnity = null; } return(SingletonMonoBehaviour <ResourceManager> .Instance.ShipTexture.Load(resourceMstId, texNum)); }