Skip to content

Commit 4e0c106

Browse files
Merge pull request #88 from Live2D/develop
Update to Cubism 5 SDK for Unity R5 beta2
2 parents 21ae7d1 + 0e63bfe commit 4e0c106

35 files changed

+1261
-788
lines changed

Assets/Live2D/Cubism/CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77

8+
## [5-r.5-beta.2] - 2025-10-14
9+
10+
### Changed
11+
12+
* Change to a method where `RenderTexture` for offscreen is pre-created in small numbers and reused.
13+
* Change the version of the development project to `6000.0.58f2`.
14+
15+
### Fixed
16+
17+
* Fix an issue where objects were not rendered when redisplayed.
18+
* Fix an issue where offscreen was not affected by `OverrideFlagForModelMultiplyColors` and `OverrideFlagForModelScreenColors`.
19+
* Fix an issue where collision detection remained active even when the collision detection Drawable was hidden.
20+
* Fix an issue where pressing the reset button in the `CubismParametersInspector` would revert to the state before the reset when running the scene.
21+
* Fix a bug that hit detection does not match the model’s visual appearance.
22+
* Fix a bug that the model may be partially clipped when rendered.
23+
* Fix the size of models using features introduced in `Cubism 5.3` differed from models created in prior to `Cubism 5.3`.
24+
* Fixed an issue where models for `Cubism 5.3` were not rendered correctly in environments where `UNITY_REVERSED_Z` is enabled.
25+
26+
827
## [5-r.5-beta.1] - 2025-08-26
928

1029
### Added
@@ -498,6 +517,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
498517
* Fix issue where Priority value was not reset after playing motion with CubismMotionController.
499518

500519

520+
[5-r.5-beta.2]: https://github.com/Live2D/CubismUnityComponents/compare/5-r.5-beta.1...5-r.5-beta.2
501521
[5-r.5-beta.1]: https://github.com/Live2D/CubismUnityComponents/compare/5-r.4.1...5-r.5-beta.1
502522
[5-r.4.1]: https://github.com/Live2D/CubismUnityComponents/compare/5-r.4...5-r.4.1
503523
[5-r.4]: https://github.com/Live2D/CubismUnityComponents/compare/5-r.3...5-r.4

Assets/Live2D/Cubism/Editor/Inspectors/CubismParametersInspectorInspector.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public override VisualElement CreateInspectorGUI()
9292
parameter.OverrideValue(parameter.DefaultValue);
9393
_elements[i].slider.value = parameter.DefaultValue;
9494
_elements[i].field.value = parameter.DefaultValue;
95+
EditorUtility.SetDirty(parameter);
9596
}
9697

9798
Undo.RecordObjects(target.Model.Parameters, "Change Parameter Values");

Assets/Live2D/Cubism/Framework/CubismUpdateController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
using Live2D.Cubism.Core;
9+
using Live2D.Cubism.Rendering;
910
using System.Collections.Generic;
1011
using UnityEngine;
1112

@@ -69,6 +70,10 @@ private void Start()
6970
/// </summary>
7071
private void LateUpdate()
7172
{
73+
// Reset `CubismOffscreenRenderTextureManager._previousActiveRenderTextureCount` at the beginning of each frame.
74+
// This ensures it's reset once per frame before any CubismRenderController OnLateUpdate.
75+
CubismOffscreenRenderTextureManager.GetInstance().ResetPreviousActiveCount();
76+
7277
// Cubism late update.
7378
if(_onLateUpdate != null)
7479
{

Assets/Live2D/Cubism/Framework/Json/CubismModel3Json.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,82 @@ public CubismModel ToModel(DrawableMaterialPicker pickDrawableMaterial, TextureP
433433
// インスタンスのTransformを親に設定
434434
instance.transform.SetParent(model.transform, false);
435435
instance.name = ModelCanvasName;
436+
437+
// Create ModelCanvas
438+
var meshFilter = instance.GetComponent<MeshFilter>();
439+
var quadWidth = model.CanvasInformation.CanvasWidth / model.CanvasInformation.PixelsPerUnit;
440+
var quadHeight = model.CanvasInformation.CanvasHeight / model.CanvasInformation.PixelsPerUnit;
441+
var halfquadWidth = quadWidth * 0.5f;
442+
var halfquadHeight = quadHeight * 0.5f;
443+
444+
var vertices = new Vector3[4]
445+
{
446+
new Vector3(-halfquadWidth, -halfquadHeight, 0),
447+
new Vector3(-halfquadWidth, halfquadHeight, 0),
448+
new Vector3(halfquadWidth, -halfquadHeight, 0),
449+
new Vector3(halfquadWidth, halfquadHeight, 0)
450+
};
451+
452+
var tris = new int[6]
453+
{
454+
0, 1, 2,
455+
2, 1, 3
456+
};
457+
458+
var normals = new Vector3[4]
459+
{
460+
-Vector3.forward,
461+
-Vector3.forward,
462+
-Vector3.forward,
463+
-Vector3.forward
464+
};
465+
466+
var uv = new Vector2[4]
467+
{
468+
new Vector2(0, 0),
469+
new Vector2(0, 1),
470+
new Vector2(1, 0),
471+
new Vector2(1, 1)
472+
};
473+
474+
475+
var fileName = model.name + ModelCanvasName;
476+
var filePath = Path.Join(Path.GetDirectoryName(AssetPath), fileName);
477+
478+
Mesh mesh = null;
479+
#if UNITY_EDITOR
480+
if (!Application.isPlaying)
481+
{
482+
mesh = AssetDatabase.LoadAssetAtPath<Mesh>(filePath + ".mesh");
483+
}
484+
#endif
485+
486+
if (mesh == null)
487+
{
488+
mesh = new Mesh()
489+
{
490+
vertices = vertices,
491+
triangles = tris,
492+
normals = normals,
493+
uv = uv
494+
};
495+
#if UNITY_EDITOR
496+
if (!Application.isPlaying)
497+
{
498+
AssetDatabase.CreateAsset(mesh, filePath + ".mesh");
499+
}
500+
#endif
501+
}
502+
else
503+
{
504+
mesh.vertices = vertices;
505+
mesh.triangles = tris;
506+
mesh.normals = normals;
507+
mesh.uv = uv;
508+
}
509+
510+
instance.transform.rotation = new Quaternion(0, 0, 0, 0);
511+
meshFilter.mesh = mesh;
436512
}
437513
}
438514
}

Assets/Live2D/Cubism/Framework/Raycasting/CubismRaycaster.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public int Raycast(Ray ray, CubismRaycastHit[] result, float maximumDistance = 1
115115
{
116116
var raycastable = Raycastables[i];
117117
var precision = RaycastablePrecisions[i];
118-
if (!raycastable.enabled)
118+
if (!raycastable.MeshRenderer.enabled)
119119
{
120120
continue;
121121
}

Assets/Live2D/Cubism/NOTICE.ja.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ Cubism SDK for UnityのSamplesでは従来の `Input Manager` を利用して入
1515
1. `Active Input Handling``both` へ変更する。
1616

1717

18-
## [制限事項] Cubism 5.3で追加された機能を使ったモデルの描画について (2025-08-26)
19-
20-
`Cubism 5 SDK for Unity R5 beta1` 以降、Cubism 5.3で追加されたブレンドモード機能やオフスクリーン機能を利用したモデルを利用する場合、新しい描画方式に切り替わって描画されます。
21-
この新しい描画方式で描画する場合に以下の不具合を確認しています。
22-
23-
* 当たり判定が見た目と異なる。
24-
* モデルが見切れて描画されることがある。
25-
26-
これらの制限事項については `Cubism 5 SDK for Unity R5 beta2` 以降で対応予定です。
27-
28-
2918
## [制限事項] WebGL書き出し時のAudioClipからのリップシンク対応について (2024-11-28)
3019

3120
Cubism SDK for Unityの音声からのリップシンクは、波形情報の取得にAudioClipのAPIを利用しています。

Assets/Live2D/Cubism/NOTICE.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ If necessary, please change your project settings to use the `Input Manager` by
1515
2. Set `Active Input Handling` to `both`.
1616

1717

18-
## [Restrictions] Rendering Models That Use the Features Added in Cubism 5.3 (2025-08-26)
19-
20-
Starting with `Cubism 5 SDK for Unity R5 beta1`, if you use models that take advantage of the blend-mode or off-screen features introduced in Cubism 5.3, they will be drawn with a new rendering method. We have confirmed the following issues with this new method:
21-
22-
* Hit detection does not match the model’s visual appearance.
23-
* The model may be partially clipped when rendered.
24-
25-
These restrictions are scheduled to be resolved in `Cubism 5 SDK for Unity R5 beta2` and later.
26-
27-
2818
## [Restrictions] Regarding lip-sync support from AudioClips when exporting to WebGL. (2024-11-28)
2919

3020
The lip-sync from audio feature in the Cubism SDK for Unity uses the AudioClip API to obtain waveform information.

Assets/Live2D/Cubism/README.ja.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ Unity Editor拡張機能は、`./Assets/Live2D/Cubism/Editor`にあります。
5454

5555
| Unity | バージョン |
5656
| --- | --- |
57-
| Latest | 6000.1.15f1 |
58-
| LTS | 6000.0.55f1 |
57+
| Latest | 6000.2.6f2 |
58+
| LTS | 6000.0.58f2 |
5959

6060
| ライブラリ / ツール | バージョン |
6161
| --- | --- |
6262
| Android SDK / NDK | *2 |
63-
| Visual Studio 2022 | 17.14.12 |
64-
| Windows SDK | 10.0.26100.4948 |
65-
| Xcode | 16.4 |
63+
| Visual Studio 2022 | 17.14.16 |
64+
| Windows SDK | 10.0.26100.6584 |
65+
| Xcode | 26.1 |
6666

6767
*2 Unityに組み込まれたライブラリまたは推奨ライブラリを使用してください。
6868

@@ -88,15 +88,15 @@ https://docs.unity3d.com/ja/2018.4/Manual/CSharpCompiler.html
8888
| プラットフォーム | バージョン |
8989
| --- | --- |
9090
| Android | 16 |
91-
| iOS | 18.6.1 |
92-
| iPadOS | 18.6.1 |
91+
| iOS | 26.0.1 |
92+
| iPadOS | 26.0.1 |
9393
| Ubuntu | 24.04.3 |
94-
| macOS | 15.6 |
94+
| macOS | 26.0 |
9595
| Windows 11 | 24H2 (*4) |
96-
| Google Chrome | 139.0.7258.128 |
96+
| Google Chrome | 141.0.7390.66 |
9797
| HarmonyOS NEXT | 5.0.0.102 |
9898

99-
*4 Unity6ではUWP向けビルドは動作確認をしておりません
99+
*4 UWP向けビルドは動作確認をしておりません
100100

101101
## ブランチ
102102

Assets/Live2D/Cubism/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ Resources like shaders and other assets are located in `./Assets/Live2D/Cubism/R
5555

5656
| Unity | Version |
5757
| --- | --- |
58-
| Latest | 6000.1.15f1 |
59-
| LTS | 6000.0.55f1 |
58+
| Latest | 6000.2.6f2 |
59+
| LTS | 6000.0.58f2 |
6060

6161
| Library / Tool | Version |
6262
| --- | --- |
6363
| Android SDK / NDK | *2 |
64-
| Visual Studio 2022 | 17.14.12 |
65-
| Windows SDK | 10.0.26100.4948 |
66-
| Xcode | 16.4 |
64+
| Visual Studio 2022 | 17.14.16 |
65+
| Windows SDK | 10.0.26100.6584 |
66+
| Xcode | 26.1 |
6767

6868
*2 Use libraries embedded with Unity or recommended.
6969

@@ -89,15 +89,15 @@ https://docs.unity3d.com/ja/2018.4/Manual/CSharpCompiler.html
8989
| Platform | Version |
9090
| --- | --- |
9191
| Android | 16 |
92-
| iOS | 18.6.1 |
93-
| iPadOS | 18.6.1 |
92+
| iOS | 26.0.1 |
93+
| iPadOS | 26.0.1 |
9494
| Ubuntu | 24.04.3 |
95-
| macOS | 15.6 |
95+
| macOS | 26.0 |
9696
| Windows 11 | 24H2 (*4) |
97-
| Google Chrome | 139.0.7258.128 |
97+
| Google Chrome | 141.0.7390.66 |
9898
| HarmonyOS NEXT | 5.0.0.102 |
9999

100-
*4 In Unity 6, we have not verified the operation of builds for UWP.
100+
*4 We have not verified the operation of builds for UWP.
101101

102102
## Branches
103103

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright(c) Live2D Inc. All rights reserved.
3+
*
4+
* Use of this source code is governed by the Live2D Open Software license
5+
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6+
*/
7+
8+
9+
using UnityEngine;
10+
11+
namespace Live2D.Cubism.Rendering
12+
{
13+
/// <summary>
14+
/// Calls release processes for classes used system-wide.
15+
/// </summary>
16+
[ExecuteInEditMode]
17+
public class CubismCommonRenderTextureController : MonoBehaviour
18+
{
19+
private void Update()
20+
{
21+
// Reset the flag at the beginning of each frame.
22+
CubismOffscreenRenderTextureManager.GetInstance().HasResetThisFrame = false;
23+
}
24+
25+
private void OnDestroy()
26+
{
27+
CubismCommonRenderFrameBuffer.GetInstance().Release();
28+
CubismOffscreenRenderTextureManager.GetInstance().Release();
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)