Help us understand the problem. What is going on with this article?

TextMeshProを使ったVCIをexe(runtime)実行で出力できない場合の対策

概要

VCIをexe(runtime)実行で出力するときに困ったことを共有します。

Version

Unity 2019.3.0f6
UniVCI-0.24

現象

TextMeshProを含むとexe(runtime)実行で出力できません。

原因

VCI.Exportから参照されるUniGLTF.ShaderPropExporter.ShaderPropsの中身にはUNITY_EDITORの記述があり、EditorはUnityEditor.ShaderUtilを使い、exe(runtime)ではUniVRMがそれ相当の実装を持つのですが、VRMはTextMeshProなど知らないので……、という予想です。

対策

無いなら作る。知らないなら教える。ということで、UniGLTF.ShaderPropExporter.PreShaderPropExporterにTextMeshPro/Distance Fieldをでっちあげます。ホントは中身があった方が良いと思いますが、無くても動いたので気にしないことにしました。

using System.Collections.Generic;


namespace UniGLTF.ShaderPropExporter
{
    public static partial class PreShaderPropExporter
    {
        [PreExportShader]
        static KeyValuePair<string, ShaderProps> TextMeshPro_Distance_Field
        {
            get
            {
                return new KeyValuePair<string, ShaderProps>(
                    "TextMeshPro/Distance Field",
                    new ShaderProps
                    {
                        Properties = new ShaderProperty[]{}
                    }
                );
            }
        }
    }
}

たぶん何処にどんな名前で保存しても良いと思うのですが、私は以下へ保存しました。
.\Assets\VRM\ShaderProperty\Runtime\TextMeshPro_Distance_Field.cs

120byte
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした