1. Breaking Changes

1.1 .サポートランタイムバージョンを.NET 4.xにアップデート

1.2 パッケージビルドバージョンをUnity2019.4.31に更新

1.3 名前空間の変更

1.4 モデル暗号化のパスワード設定

using Pixiv.VroidSdk.Api.Legacy;
using Pixiv.VroidSdk.Api.DataModel;

private void LoadModel(CharacterModel characterModel, string password)
{
		HubModelDeserializer.Instance.LoadCharacterAsync(
		    characterModel: characterModel,
        encryptPassword: password, // モデルの暗号化に使うパスワードを設定
		    onLoadComplete: (GameObject characterObj) => onSuccess(characterObject),
		    onDownloadProgress: (float progress) => onProgress(progress),
		    onError: (Exception error) => onError(error)
		);

		// optionを使いキャッシュ数など細かい設定が可能
    // ただし、パスワードは設定必須になります
		var option = new HubModelDeserializerOption {
				MaxCacheCount = 20,
        CacheEncryptPassword = password, // モデルの暗号化に使うパスワードを設定
		};
		HubModelDeserializer.Instance.LoadCharacterAsync(
		    characterModel: characterModel,
				option: option,
		    onLoadComplete: (GameObject characterObj) => onSuccess(characterObject),
		    onDownloadProgress: (float progress) => onProgress(progress),
		    onError: (Exception error) => onError(error)
		);
}

1.5 DataModelを参照型に統一

using Pixiv.VroidSdk.Api.DataModel;

public class Model : ApplicationModel
{
		 // クラス宣言が参照型になったのでNull許容型で宣言することはできない
-    public Account? CurrentUser { get; set; }
+    public Account CurrentUser { get; set; }

    public Model()
    {
        CurrentUser = null;
    }
}

1.6 LocalStorageの廃止とキャッシュのフォーマット変更

1.7 プロパティAPIのレスポンスのGltfMaterial#extensionsがDictionaryからGltfMaterialExtensionsに変更

public override void Init(GltfMaterial baseData)
{
    if (baseData.extensions != null)
    {
        stringBuilder.Append("\\n");
        // v0.0.xはDictionaryを返す
        foreach (var x in baseData.extensions)
        {
            stringBuilder.AppendLine("\\t" + x.Key + ":" + x.Value);
        }
    }
}
public override void Init(GltfMaterial baseData)
{
    if (baseData.extensions != null)
    {
        stringBuilder.Append("\\n");
        // v0.1.0以降はGltfMaterialExtensions型を返し、KHR_materials_unlitがあるかないかが判定できる
        if (baseData.extensions.KHR_materials_unlit != null)
        {
            stringBuilder.AppendLine("\\t KHR_materials_unlit:{}");
        }
    }
}

1.8 HubApiとHubModelDeserializerの初期化

class Hoge : MonoBehaviour
{
    void Start()
    {
			HubApi.GetAccountCharacterModels(
			    count: 10,
			    onSuccess: (List<CharacterModel> characterModels) => {
							HubModelDeserializer.Instance.LoadCharacterAsync(
							    characterModel: characterModels[0],
							    onDownloadProgress: (float progress) => {
							    },
							    onLoadComplete: (GameObject characterObj) => {
											characterObj.transform.parent = this.transform;
							    },
							    onError: (Exception error) => {
							    }
							);
					},
			    onError: (ApiErrorFormat errorFormat) => { /* 通信エラーなどのエラーが発生した時の処理 */ }
			);
    }
}
class Hoge : MonoBehaviour
{
    void Start()
    {
      // 通信Driver設定 (ない場合はデフォルトでUnityWebRequestを利用)
			var driver = new HttpClientDriver(SynchronizationContext.Current);
      Authentication.Instance.Init(_sdkConfiguration.AuthenticateMetaData, driver);

			// HubApiの初期化
      // 内部で自動的に `HubModelDesiriazer.Instance` の初期化も行われる
      HubApi.Initialize(Authentication.Instance.Client, _sdkConfiguration.GetConfig());

			// 認可
      Authentication.Instance.AuthorizeWithExistAccount(...);

			HubApi.GetAccountCharacterModels(
			    count: 10,
			    onSuccess: (List<CharacterModel> characterModels) => {
							HubModelDeserializer.Instance.LoadCharacterAsync(
							    characterModel: characterModels[0],
							    onDownloadProgress: (float progress) => {
							    },
							    onLoadComplete: (GameObject characterObj) => {
											characterObj.transform.parent = this.transform;
							    },
							    onError: (Exception error) => {
							    }
							);
					},
			    onError: (ApiErrorFormat errorFormat) => { /* 通信エラーなどのエラーが発生した時の処理 */ }
			);
    }
}

2. Deprecated

2.1 従来のインターフェースの廃止

以下のクラスがDeprecatedになります。それぞれ代替手段があるのでそちらへの移行を検討してください

認可

API利用

モデルのロード

2.2 SDKConfigurationの廃止

従来のSDKではSDKConfigurationにアプリケーションIDやシークレットを入力して設定してもらってましたが、0.1.0以降では非推奨となります。

代わりにアプリケーション管理画面から credential.json.bytes をダウンロードしていただきそれを利用してください。

3. New Features

3.1 認可・API実行・モデル読み込みのインターフェースを実装

3.2 通信バックエンドの差し替えの仕組みを変更できるようにした

3.3 Loopback interface redirect実装

4. Changes

4.1 サードパーティ製ライブラリの置き換え

4.2 UniVRMをv0.89.0にアップデート

5. Bug fixed

5.1 iOSでの認証時にURLスキーム周りでエラーが発生するバグを修正しました