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
Author And Source
この問題について(TextMeshProを使ったVCIをexe(runtime)実行で出力できない場合の対策), 我々は、より多くの情報をここで見つけました https://qiita.com/120byte/items/2094314723f83ea7c600著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .