统一集成与Eclipse - 如何顺应"公务"教程的指示?公务、指示、教程、Eclipse

2023-09-05 00:24:38 作者:一身狼狈

我看过所有我发现在如何整合目标到Android到Eclipse Unity3D项目的文档。我想这样做的原因是为了能够在我自己的正常的Andr​​oid应用程序中调用Unity3D活动。

I have read all the documentation I found on how to integrate Unity3D projects targeted to Android into eclipse. The reason I want to do that is to be able to call the Unity3D Activity within my own "normal" Android application.

嗯,我试着按照步骤listed在本教程中。 使用所有组合我能想象,我做了以下内容:

Well, I tried to follow the steps listed on this tutorial. Using all the combinations I can imagine, I did the following:

我用的是统一的Andr​​oid项目,并建立它(统一内 IDE),然后复制 /温度/ StagingArea / 文件夹到另一个位置。

I used the Unity Android project and built it (within the Unity IDE), then copied the /Temp/StagingArea/ folder to another location.

我创建了一个新的Andr​​oid项目,利用现有资源创造, 设置 StagingArea 复制文件夹的位置。这将是 Android的图书​​馆项目。检查属性是图书馆 - > Android系统。

I created a new Android project, using create from existing sources, setting the location of the StagingArea copy folder. This would be the Android Library Project. Check "is Library" on properties -> Android.

此外,我创建一个Android项目,导入pviusly创造了$ P $ Android的图书​​馆项目和 classes.jar

Again, I create an Android project, import the previusly created Android Library project and classes.jar.

我的举动的资产文件夹从库项目的内容 活动项目。它有两个子文件夹,

I move the asset folder contents from the Library project to the "Activity" project. It has two subfolders, bin and libs.

我修改生成的活性,延长 UnityPlayerActivity 和 除去onCreate方法的setContent线。更改 包相匹配的统一播放器捆绑ID。

I modify the generated Activity to extend UnityPlayerActivity and remove the setContent line of the onCreate method. Change the package to match the Unity Player bundle id.

添加相应的线条来体现,基本上那些上 该库项目。

Add the corresponding lines to manifest, basically those that are on the Library project.

所以编译没有错误,我可以运行该项目,显示启动画面,然后黑屏,正确打我的团结场景的声音。在logcat中揭示了以下错误:

So everything compiles without errors, and I can run the project, shows the splash screen, and then a black screen, playing the sounds of my Unity Scene correctly. The logcat reveals the following errors:

01-26 16:51:46.415: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.415: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.415: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.415: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.415: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.415: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.415: I/Unity(2299): StopQCAR
01-26 16:51:46.415: I/Unity(2299): UnityEngine.Debug:Internal_Log(Int32, String, Object)
01-26 16:51:46.415: I/Unity(2299): UnityEngine.Debug:Log(Object)
01-26 16:51:46.415: I/Unity(2299): UnityEngine.MonoBehaviour:print(Object)
01-26 16:51:46.415: I/Unity(2299): TrackerBehaviour:StopQCAR()
01-26 16:51:46.415: I/Unity(2299): TrackerBehaviour:OnApplicationPause(Boolean)
01-26 16:51:46.415: I/Unity(2299):  
01-26 16:51:46.415: I/Unity(2299): (Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/Export/Generated/UnityEngineDebug.cpp Line: 34)
01-26 16:51:46.425: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.425: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.425: I/Unity(2299): DllNotFoundException: QCARWrapper
01-26 16:51:46.425: I/Unity(2299):   at (wrapper managed-to-native) TrackerBehaviour:stopTracker ()
01-26 16:51:46.425: I/Unity(2299):   at TrackerBehaviour.StopQCAR () [0x00000] in <filename unknown>:0 
01-26 16:51:46.425: I/Unity(2299):   at TrackerBehaviour.OnApplicationPause (Boolean pause) [0x00000] in <filename unknown>:0 

只是提...阅读这两个SO问题:1和2.它们似乎都succeded,所以能够实现以下这些步骤(或类似)。

Just to mention... read these two SO questions: 1 and 2. They seem to have succeded, so it is possible to achieve following those steps (or similar).

我还发现有用在Unity3D论坛,这基本上说明了这个话题同样proccess以更清晰的方式。

I also found useful this topic on the Unity3D forum, which basically describes the same proccess in a clearer way.

有没有人遇到过这个问题?任何建议或替代方案?

Has anybody experienced this issue? Any suggestion or alternative?

问候。

推荐答案

对于任何过这个绊脚石,Unity3d集成到一个Android Eclipse项目在previous版本(3.5)被打破了!

For anyone stumbling across this, the integration of Unity3d into an android eclipse project was broken in the previous version (3.5)!

使用Unity的新版本(3.5.2测试成功),一切工作正常后再次这些步骤。

Using a newer version of Unity (successfully tested with 3.5.2) everything works fine again following these steps.

如果您要定义自己的活动或使用统一的片段里面,你可以直接使用UnityPlayer类。要做到这一点,你可以看看[UNITY_INSTALLATION]\Editor\Data\PlaybackEngines\androidplayer\src\com\unity3d\player中提到的统一论坛。

If you want to define your own activity or use Unity inside a fragment, you can use the UnityPlayer class directly. To do so you can have a look at [UNITY_INSTALLATION]\Editor\Data\PlaybackEngines\androidplayer\src\com\unity3d\player as mentioned in the Unity Forum.

或只是尝试,为我们带来了这个code:

Or just try this code that worked for us:

    UnityPlayer mPlayer = new UnityPlayer(getActivity()); // Put your activity object here
    int glesMode = mPlayer.getSettings().getInt("gles_mode", 1);
    boolean trueColor8888 = false;
    mPlayer.init(glesMode, trueColor8888);

    // Get the view - e.g. to return from the fragment method onCreateView:
    View view = mPlayer.getView();

更新:第一个环节是不可用unity3d支持页面上了,但论坛条目包含所有必需的步骤太

Update: The first link is not available on the unity3d support page anymore, but the forum entry contains all needed steps too!