jacksondunstan / UnityNativeScripting

Unity Scripting in C++
https://jacksondunstan.com/articles/3938
MIT License
1.33k stars 135 forks source link

CodeGen Compatibilty breaks #47

Closed sekkit closed 5 years ago

sekkit commented 5 years ago

NativeScriptTypes.zip

With this config and master codebase no any change, Editor runs fine, il2cpp standalone build crashes, mono standalone build throughs error like this:

image

If add VisualElement to Types, c++ bindings won't compile at all.

jacksondunstan commented 5 years ago

I tried to generate the bindings using the repo, but it seems that it depends on some of your project-specific code. Since I still have the project from #45, I generated in that project. As you say, there was no issue inside the editor so I went to try a standalone build. Even after replacing your paths (/Users/sekkit/...) with mine, I still get 200+ errors building in Xcode. I don't want to spend hours getting this project to work, like we did with #45. Can you please provide a project that doesn't require configuration to reproduce the issue?

sekkit commented 5 years ago

ok, will sent you later.

jacksondunstan commented 5 years ago

I received the project you sent me by e-mail, opened it in Unity, and successfully generated the bindings. Is there something else I'm supposed to do to reproduce the issue?

sekkit commented 5 years ago

U shall select .net3.5 runtime, il2cpp, and compiles it.

jacksondunstan commented 5 years ago

.NET 3.5 was already selected, but I switched to IL2CPP and the bindings still generate just fine.

Re-reading your initial comment, I'm confused about what the issue is. It sounds like you might be reporting two different issues, so I'm not sure which the project you sent me is attempting to reproduce. Can you please list the steps I should take and the expected and observed behavior like so?

1. Do this
2. Do that
3. Do another thing

Expected: It did X
Observed: It did Y

For example, here's what I've done to try to reproduce the issue:

1. Download and extract the project ZIP file you e-mailed me
2. Open the project in Unity 2018.3
3. Change the scripting backend to IL2CPP
4. Generate bindings

Expected: Bindings are generated
Observed: Bindings are generated
sekkit commented 5 years ago

u must build it. cmd+shift+B, press build. the Macro will ignore the errors, so even you generate successfully but it won't build a Standalone binary file.

jacksondunstan commented 5 years ago

I tried to make a build, but ran into a compiler error during the build process. When I looked to see why the error was happening, I discovered that the version of the project you're using contains the MonoBehaviour specific functionality that was removed in March 2018 by f3f0139e45be39cc4d8a2aac01c92f8d354a472a. I won't be fixing bugs in very old versions of the repository. Feel free to submit a new issue if it can be reproduced in the latest version of the repository.

sekkit commented 5 years ago

I remember the demo project sent to your email doesn't contain Monobehaviour types definition. well, just comment out the Monobehaviours section. But there are other compilation errors using your latest codebase. Then you manually correct those compilation errors, it compiles fine. (problem 1) BUT the cpp project doesn't compile correctly. (problem 2)

SO, briefly speaking, when add some other types to json file, it does not work as expected.