swift-unity icon indicating copy to clipboard operation
swift-unity copied to clipboard

Unity+Vuforia setup needs extra steps

Open MRzr opened this issue 6 years ago • 12 comments

Hi,

thanks for your effort to make swift with unity easier to make it work.

When using Vuforia, there is some extra work that needs to be done in order to work as expected. In my case ImageTarget was not working. Xcode error was Dataset 'XYZ' could not be loaded and cannot be activated.

Unity creates folder Data which is not copied by run scripts. I solved a problem by copying Data folder to project Unity folder and adding folder reference to Vuforia (Data/Raw/Vuforia) to my project.

I don't know if this is too specific problem to be solved by your script. If it is this issue can at least help someone who will needs to work with Vuforia.

MRzr avatar Feb 23 '18 11:02 MRzr

I don't know what is special in Vuforia that the Data folder has to be added to project. The script does copy the Data folder, but directly to the app folder because by default the Data folder is only used in run time.

echo "Syncing data from $UNITY_IOS_EXPORT_PATH..." rm -rf "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data" cp -Rf "$UNITY_IOS_EXPORT_PATH/Data" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data"

Do you mean adding the Data folder into project solves the "Dataset 'XYZ' could not be loaded and cannot be activated." problem? Would you mind compare the build output to see what's different so we can adjust the script to handle Vuforia?

jiulongw avatar Feb 23 '18 17:02 jiulongw

I guess it's because Vuforia searches for resources contained in that folder and try to load it from main bundle. Is cp command is works exactly as what Xcode does in Copy Bundle Resource step?

Build accolade_2018-02-27T13-35-20 : With Vuforia.txt Build accolade_2018-02-27T13-41-28.txt

MRzr avatar Feb 27 '18 12:02 MRzr

Hi I also encountered a similar problem, Vuforia ARCamera can not work, the problem is repeated: unity2017.3.1f1 + xcode9.2

  1. Open jiulongw's demo (./unity), demo scene Add ARCamera (GameObject> Vuforia> ARCamera), delete MainCamera.
  2. Build setting: set camera usage description to demoApp set target minimum ios version to 9.0
  3. Build to tmp folder
  4. open xcode project (./xcode/DelayApp.xcodeproj), set Enable Bitcode for build setting to NO.
  5. Select Device (Need a real machine), command + B, Build succeeded.
  6. command + R, run for real machine, app crash. image

xh4010 avatar Mar 07 '18 08:03 xh4010

vuforia ARcamera not work bug is solved, refer issues #34

Try going into your Player settings -> Other Settings and · turn off Auto Graphics API, · delete 'Metal' from the Graphics API list.

xh4010 avatar Mar 08 '18 01:03 xh4010

@MRzr what were the steps you performed to add the Vuforia folder reference to your project? We are encountering a similar issue where ImageTarget is not working.

mayntos avatar Mar 09 '18 19:03 mayntos

@mayntos try to add Data folder into Xcode project. Xcode might be doing extra steps other than simply copy content to app output.

jiulongw avatar Mar 09 '18 21:03 jiulongw

@mayntos I've tested this multiple times. The only thing other than following steps in instruction that you need to do is to import Data folder into project. Steps:

  1. Open Unity folder (one you've already copied into your Xcode project) in Finder
  2. Copy Data folder from folder generated by Unity.
  3. In your Xcode project select Unity folder, press right click and choose "Add files to PROJECT_NAME"
  4. Choose Data/Raw/Vuforia folder. Press Options button and select "Create folder references" in "Added folders" option.
  5. Make sure that Vuforia folder is in Target Settings -> Build Phases -> Copy Bundle Resources.

You don't need to do it every time you generate project in Unity. Do it only when you change targets in Unity.

Let me know if you have any problems.

piotrdebosz avatar Mar 10 '18 14:03 piotrdebosz

@piotrdebosz Could you please help me with wikitude I am not able to do with scripting so i manullay copy paste library , classes folder and as you suggest data folder but i am getting compile time error

d: library not found for

PrashantKT avatar Apr 27 '18 14:04 PrashantKT

I'm trying to build the demo with Vuforia but keep getting this error when the camera is initialized:

cameraDeviceStartCamera
ERROR/AR(545) 2018-04-31 22:41:15: VideoBackgroundConfig with screen size of zero received, skipping config step

Did all of the things mentioned above (turn off bitcode, turn off metal, copy and reference Data folder). Any ideas?

metamorphious avatar Apr 30 '18 20:04 metamorphious

@metamorphious do you encounter black screen? its iOS 11.3 & vuforia issue. it is sloved in vuforia version 7.1.34 you can update from unity 2018.1.

MRzr avatar Apr 30 '18 20:04 MRzr

@yeah had black screens. Tried with Unity 2018.1 beta (and finally vuforia 7.1.34, it kept install into unity 2017) but now the unity storyboard isnt found anymore: 'Storyboard (<UIStoryboard: 0x1d066ce00>) doesn't contain a view controller with identifier 'unitySplashStoryboard''

metamorphious avatar Apr 30 '18 21:04 metamorphious

@metamorphious i think it is because XcodePostBuild script is not yet compatible with 2018.1 try to open new issue becuase your problem is not relevant with this issue

MRzr avatar May 03 '18 08:05 MRzr