Add warning in inspector UI for incompatible VRCSDK versions. (#147)

This commit is contained in:
bd_ 2022-12-09 11:40:16 -08:00 committed by GitHub
parent b7b4fde863
commit e7ec5b08b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 2 deletions

View File

@ -33,15 +33,19 @@ namespace nadena.dev.modular_avatar.core.editor
[InitializeOnLoad] [InitializeOnLoad]
internal static class ComponentAllowlistPatch internal static class ComponentAllowlistPatch
{ {
internal static readonly bool PATCH_OK;
static ComponentAllowlistPatch() static ComponentAllowlistPatch()
{ {
try try
{ {
PatchAllowlist(); PatchAllowlist();
PATCH_OK = true;
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogException(e); Debug.LogException(e);
PATCH_OK = false;
} }
} }

View File

@ -1,6 +1,7 @@
using UnityEditor; using UnityEditor;
using UnityEditor.Experimental.SceneManagement; using UnityEditor.Experimental.SceneManagement;
using UnityEngine; using UnityEngine;
using UnityEngine.SocialPlatforms;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
{ {
@ -19,5 +20,10 @@ namespace nadena.dev.modular_avatar.core.editor
EditorGUILayout.HelpBox(Localization.S("hint.not_in_avatar"), MessageType.Warning); EditorGUILayout.HelpBox(Localization.S("hint.not_in_avatar"), MessageType.Warning);
} }
} }
public static void DisplayVRCSDKVersionWarning()
{
EditorGUILayout.HelpBox(Localization.S("hint.bad_vrcsdk"), MessageType.Error);
}
} }
} }

View File

@ -116,6 +116,7 @@ namespace nadena.dev.modular_avatar.core.editor
} }
InspectorCommon.DisplayOutOfAvatarWarning(targets); InspectorCommon.DisplayOutOfAvatarWarning(targets);
if (!ComponentAllowlistPatch.PATCH_OK) InspectorCommon.DisplayVRCSDKVersionWarning();
OnInnerInspectorGUI(); OnInnerInspectorGUI();
} }

View File

@ -53,5 +53,6 @@
"boneproxy.attachment": "Attachment mode", "boneproxy.attachment": "Attachment mode",
"boneproxy.attachment.AsChildAtRoot": "As child; at root", "boneproxy.attachment.AsChildAtRoot": "As child; at root",
"boneproxy.attachment.AsChildKeepWorldPosition": "As child; keep position", "boneproxy.attachment.AsChildKeepWorldPosition": "As child; keep position",
"pb_blocker.help": "This object will not be affected by PhysBones attached to parents." "pb_blocker.help": "This object will not be affected by PhysBones attached to parents.",
"hint.bad_vrcsdk": "Incompatible version of VRCSDK detected.\n\nPlease try upgrading your VRCSDK; if this does not work, check for a newer version of Modular Avatar as well."
} }

View File

@ -53,5 +53,6 @@
"boneproxy.attachment": "配置モード", "boneproxy.attachment": "配置モード",
"boneproxy.attachment.AsChildAtRoot": "子として・ルートに配置", "boneproxy.attachment.AsChildAtRoot": "子として・ルートに配置",
"boneproxy.attachment.AsChildKeepWorldPosition": "子として・ワールド位置を維持", "boneproxy.attachment.AsChildKeepWorldPosition": "子として・ワールド位置を維持",
"pb_blocker.help": "このオブジェクトは親のPhysBoneから影響を受けなくなります。" "pb_blocker.help": "このオブジェクトは親のPhysBoneから影響を受けなくなります。",
"hint.bad_vrcsdk": "使用中のVRCSDKのバージョンとは互換性がありません。\n\nVRCSDKを更新してみてください。それでもだめでしたら、Modular Avatarにも最新版が出てないかチェックしてください。"
} }