Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRMExporterがiOSランタイム実行でMissingMethodExceptionを吐いて止まる #30

Closed
kamanii24 opened this issue Aug 28, 2018 · 3 comments

Comments

@kamanii24
Copy link

iOSランタイム上でVRMRuntimeExporterのOnExportClickedメソッド内のvrm.ToGlbBytes()実行時にMissingMethodExceptionを吐いて止まります。

// glTF.cs
public byte[] ToGlbBytes()
{
            var json = ToJson();    // ここで止まる
~

さらに中を見ていくと、JsonFormatter.csで Func<T> func = expression.Compile(); が呼ばれていたので、これが原因だと思いますが代替する方法などありましたらお願いいたします。

@ousttrue
Copy link
Contributor

JsonにSerializeするときに使っています。

        protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            f.KeyValue(() => name); // これを実装するのに使っている
         }

下記の記法に置換すれば、KeyValue関数を削除できると思います。

            f.Key("name"); f.Value(name); // これと同じ意味

@kamanii24
Copy link
Author

kamanii24 commented Aug 28, 2018

ありがとうございます!
KeyValueに当たる部分全て置換して、一部gltfクラスの変数にはGLTFValue()を設定しました。
上記対応して実行したところ、JsonFormatException: key not exptected エラーで止まってしまったのですがこの場合のエラーの原因はわかりますか?
誤字かと思い見直してみましたが、そうではなさそうでした。

エラー全文です

JsonFormatException: key exptected
UniJSON.JsonFormatter.CommaCheck (Boolean isKey) (at Assets/VRM/UniGLTF/UniJSON/Scripts/JsonFormatter.cs:121)
UniJSON.JsonFormatter.Value (Int32 x) (at Assets/VRM/UniGLTF/UniJSON/Scripts/JsonFormatter.cs:254)
UniGLTF.glTFAttributes.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTFMesh.cs:56)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.GLTFJsonFormatter.GLTFValue (UniGLTF.JsonSerializableBase s) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:13)
UniGLTF.glTFPrimitives.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTFMesh.cs:127)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.GLTFJsonFormatter.GLTFValue (UniGLTF.JsonSerializableBase s) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:13)
UniGLTF.GLTFJsonFormatter.GLTFValue[glTFPrimitives] (IEnumerable`1 values) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:21)
UniGLTF.glTFMesh.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTFMesh.cs:174)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.GLTFJsonFormatter.GLTFValue (UniGLTF.JsonSerializableBase s) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:13)
UniGLTF.GLTFJsonFormatter.GLTFValue[glTFMesh] (IEnumerable`1 values) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:21)
UniGLTF.glTF.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTF.cs:347)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.glTF.ToGlbBytes () (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTF.cs:397)

@ousttrue
Copy link
Contributor

f.Key("field_name"); f.Value(field_name); というようにペアで使ってください。
key value key valueの順番で来ることをチェックしていて違反したとき(key value valueなど)にJsonFormatException: key exptectedが出ます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants