Coder Social home page Coder Social logo

deptagency / unity-ios Goto Github PK

View Code? Open in Web Editor NEW
43.0 4.0 3.0 94.78 MB

A repository of scripts and configs for embedding a Unity app inside a native Swift project. Sample project included.

License: MIT License

C# 0.02% ShaderLab 0.01% C 0.48% Objective-C++ 0.33% C++ 98.44% Objective-C 0.73% Ruby 0.01% Swift 0.01%

unity-ios's Introduction

Unity-iOS

A repository of scripts and configs for embedding a Unity app inside a native Swift project. This repo is a template for projects wanting to do this. Sample Xcode and Unity projects are included.

Usage

This repository uses Git Large File Storage (LFS). To install LFS, follow these instructions:
https://help.github.com/articles/installing-git-large-file-storage/

Clone the repo and run git lfs pull in your clone directory, then build and run the sample Swift project. The sample app is a simple screen with a button to launch the Unity AR experience. When running in the simulator, the Unity scene displays text that indicates AR isn't supported. When running on device, the scene displays the Vuforia camera.

Aim the camera at the test image included in this repo to view the astronaut in AR! Tap on the astronaut to trigger an animation.

Setting up your own project

This repo serves as a template for how to configure both the Xcode and Unity projects for seamless integration of Unity into a native Swift app. If you're starting a new project from scratch, or want to integrate Unity into an existing Xcode project, follow these steps:

Xcode Setup

  1. Add the iOS/Sample/Config directory to your project.

  2. Add the iOS/Sample/Unity directory to your project.

  3. If using Cocoapods, change the xcconfig name in the Debug and Release configs in the Config directory. You can't use variables in the path, but the included Cocoapods config should be this format:

    • Pods-$(TARGET_NAME).debug.xcconfig
    • Pods-$(TARGET_NAME).debug.xcconfig
  4. Set the Configuration for your Debug and Release targets to the appropiate config from the Config directory. Your project settings should then look similar to this:

configuration

  1. Add a new Run Script build phase with the contents of Copy Unity Data script from the sample project. If you're using Unity 2018.3 or later, also add a Run Script phase with the contents of the Embed Unity Dylibs (Simulator Only) script from the sample project.

  2. If using Vuforia, disable Metal API validation in Scheme -> Options. If not using Vuforia, you can delete Vuforia.xcconfig from the Config directory.

metal validation

  1. Add this line in your app delegate's didFinishLaunchingWithOptions::
UnityViewController.shared.configure(with: application, options: launchOptions)

Unity Setup

  1. Add contents of Unity/Assets/Editor/Build and Unity/Assets/Scripts to your project

  2. Add either Scene-Device or Scene-Simulator labels to your scenes. The build script looks for these labels to determine which scenes to include for which target. To include a scene on both simulator and device, add both labels.

  3. Make sure project is set to use .NET 4x equivalent in Project Settings.

  4. If using Vuforia and on-device data sets (as opposed to a Cloud Target Database), add ConfigureVuforiaDatasetLoader to your AR scene.

unity-ios's People

Contributors

jvisenti avatar

Stargazers

Erick Zamudio avatar Al Hasan Sony avatar Davide Talevi avatar Maxim Kolesnik avatar Antol avatar  avatar  avatar 양채연스 avatar Safa Aşkın avatar  avatar 曲致 avatar American Bear  avatar jay down avatar Ekin Ozturk avatar  avatar Rinkal C avatar  avatar Samuel Wang avatar Rish avatar Dave Barner avatar Clint Herron avatar jjaychen avatar chao avatar Minsoo Kim avatar Andreas Bruns avatar Roberto avatar  avatar  avatar Ashlee Muscroft avatar J Black avatar luohaoyuan avatar LaiYoung_ avatar JinHua Huang avatar Yegucheng avatar Abraão Azevedo Nascimento avatar Jon Cardasis avatar Alyssa McDevitt avatar Alexander Smith avatar Chris Momoyama avatar NickArthur avatar JB avatar shashi avatar Thariq Shihipar avatar

Watchers

James Cloos avatar  avatar NickArthur avatar Gian Colombi avatar

unity-ios's Issues

Undefined symbol: _UnityGetGLView

Hi I got several errors of undefined symbol:

Undefined symbols for architecture x86_64: "_UnityGetGLView", referenced from: SMarket.UnityViewController.viewDidLoad() -> () in UnityViewController.o "_OBJC_CLASS_$_UnityAppController", referenced from: objc-class-ref in UnityViewController.o "_UnityUnregisterLifeCycleListener", referenced from: SMarket.UnityViewController.__deallocating_deinit in UnityViewController.o "__unityAppReady", referenced from: _UnityReady in UnityBridge.o "__renderingInited", referenced from: _UnityReady in UnityBridge.o "RegisterMonoModules()", referenced from: _UnityMain in UnityBridge.o "_UnityInitRuntime", referenced from: _UnityMain in UnityBridge.o "_UnityRegisterLifeCycleListener", referenced from: SMarket.UnityViewController.() -> SMarket.UnityViewController(in _DD7D669076043A5E954295332A532BD7).init() -> SMarket.UnityViewController in UnityViewController.o "_UnityGetGLViewController", referenced from: ShowSplashScreen(UIWindow*) in UnityBridge.o "UnityInitTrampoline()", referenced from: _UnityMain in UnityBridge.o "RegisterFeatures()", referenced from: _UnityMain in UnityBridge.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Could you help with that?

Export unity sources as an iOS Framework

Hello! I'm just trying to export or integrate the unity source files as an iOS Framework but always get error... Is there a way to export it directly from Unity?

Thanks in advance.

Generating the Xcode Project

Hey there!!!

Can I know how did you setup the Xcode project? Like did you create a new project inside this folder called iOS or it was generated by unity?

error: Unable to load contents of file list: '/Target Support Files/Pods-xxx/Pods-xxx-frameworks-Debug-input-files.xcfilelist' (in target 'xxx')

Hi I got this error when trying to integrate Unity in my own project.

XCode Version 10.2.1

error: Unable to load contents of file list: '/Target Support Files/Pods-SMarket/Pods-SMarket-frameworks-Debug-input-files.xcfilelist' (in target 'SMarket')

error: Unable to load contents of file list: '/Target Support Files/Pods-SMarket/Pods-SMarket-frameworks-Debug-output-files.xcfilelist' (in target 'SMarket')

error: Unable to load contents of file list: '/Target Support Files/Pods-SMarket/Pods-SMarket-resources-Debug-input-files.xcfilelist' (in target 'SMarket')

error: Unable to load contents of file list: '/Target Support Files/Pods-SMarket/Pods-SMarket-resources-Debug-output-files.xcfilelist' (in target 'SMarket')

My Target -> Build Phases:
Screen Shot 2019-05-16 at 1 27 51 PM

[CP] Copy Pods Resources
Screen Shot 2019-05-16 at 1 29 24 PM

[CP] Embed Pods Frameworks
Screen Shot 2019-05-16 at 1 29 29 PM

I tried this solution /clean and rebuild the project, still failed, do you have any idea about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.