npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-unityar

v1.0.1

Published

Plugin to integrate unity3d player into a cordova application for both android and iOS platforms

Downloads

4

Readme

Cordova Plugin UnitAR

Description

The plugin describes how to integrate Unity into a cordova based project. Unity has introduced a new feature to use Unity as a library in native apps (Android and iOS). This feature is exploited to create this plugin.

I would like to give credits to the following repos that helped me while creating this plugin

Requirements

  • Xcode 9.4+
  • Android Studio 3.4.2+
  • Unity version 2019.3.0b11+, 2020.1.0a13+
  • Cordova 9.0.0
  • Cordova Android 8.1.0
  • Cordova iOS 5.1.1

Installation

Import the plugin to the cordova project

cordova plugin add cordova-plugin-unityar

  • To launch unity from the cordova project call the following method in your javascript

UnityAR.launchWithMessage(GameObject,MethodName,Argument)

UnityAR.launchWithMessage("Manager","GetMessageFromCordova","Cordova Msg",
(data)=>{
     console.log("success ",data);
 },(err)=>{
     console.log("error ",err);
});;

Unity Setup

Create a project in unity. Copy the following files from the files folder in the repository to the respective folders in unity project

  • Copy NativeCallProxy.mm and NativeCallProxy.h to Assets/Plugins/iOS
  • Copy OverrideUnityActivity.java to Assets/Plugins/Android
  • Copy CordovaComm.cs to Scripts folder

The following method can be accessed from CordovaComm.cs Unity C# script to quit Unityplayer and come back to cordova project

public void quitUnity(string feedbackMsg)

feedbackMsg :- to send message back to cordova from unity.

For Android :- Export project from Unity to generate an android project

For iOS :- Export as an iOS project to a folder.

Cordova Android setup

  • Copy unitylibrary generated in the unity build to the platforms/android folder of the cordova project

  • Add android.library.reference.3=unityLibrary to project.properties

  • Add the following code flatDir { dirs "${project(':unityLibrary').projectDir}/libs" } to allprojects { repositries { }} in build.gradle in platforms/android folder

  • Add the following implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: ['*.jar']) to dependencies below subproject comment in platforms/android/app build.gradle folder

  • Make sure min sdk version of both cordova project and unityproject are same

  • From AndroidManifest.xml of unityLibrary folder, remove the following code to prevent two apps from being installed on the device <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>

Cordova iOS Setup

  • Build the cordova project for iOS from terminal. When it fails open the workspace in xcode

  • Delete main.mm from Cordova project Other Sources Folder

  • Copy or replace AppDelegate.mm and AppDelegate.h from the files folder of this repo to Cordova project. The files should exist in Classes folder of cordova ios project

  • Add unity ios project to this workspace

  • Add UnityFramework.framework Select cordovaiOSApp target from cordovaiOSApp project. In General tab Frameworks, Libraries, and Embedded Content press '+'. Add Unity-iPhone/UnityFramework.framework. In Build Phases tab, expand Link Binary With Libraries. Remove UnityFramework.framework from the list (select it and press '-' ).

  • Expose NativeCallProxy.h In Project navigator, find and select Unity-iPhone/Libraries/Plugins/iOS/NativeCallProxy.h. Enable UnityFramework in Target Membership and set header visibility from project to public (small dropdown on right side to UnityFramework)

  • Make Data folder to be part of the UnityFramework change Target Membership for Data folder to UnityFramework

  • Copy Launcher files to Current project for splashscreen.mm