示例#1
0
        public bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
        {
            var settings = ValidatorSettingsUtility.GetOrCreateSettings();

            if (!settings.validateOnUploadAvatar)
            {
                return(true);
            }

            var type   = typeof(VRCSdkControlPanelAvatarBuilder);
            var field  = type.GetField("_selectedAvatar", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
            var avatar = field.GetValue(null) as VRCAvatarDescriptor;

            if (avatar == null)
            {
                return(true);
            }
            Selection.activeObject = avatar.gameObject;

            var resultDictionary = VRCAvatars3Validator.ValidateAvatars3(avatar, settings.rules);

            if (resultDictionary
                .Any(result => result.Value.Any(
                         r => r.ResultType == ValidateResult.ValidateResultType.Error ||
                         r.ResultType == ValidateResult.ValidateResultType.Warning)))
            {
                VRCAvatars3ValidatorView.Open();
                return(false);
            }

            return(true);
        }
        bool VRC.SDKBase.Editor.BuildPipeline.IVRCSDKBuildRequestedCallback.OnBuildRequested(VRC.SDKBase.Editor.BuildPipeline.VRCSDKRequestedBuildType requestedBuildType)
        {
            // VRCSDK3 からビルドリクエストされた場合はここでクリア&初期化する
            switch (requestedBuildType)
            {
            case VRC.SDKBase.Editor.BuildPipeline.VRCSDKRequestedBuildType.Avatar:
                Core.InitUsedShaderVariantList(WFBuildPlatformType.VRCSDK3_Avatar);
                break;

            case VRC.SDKBase.Editor.BuildPipeline.VRCSDKRequestedBuildType.Scene:
                Core.InitUsedShaderVariantList(WFBuildPlatformType.VRCSDK3_World);
                break;
            }
            return(true);
        }