4.0.2 • Published 2 years ago

xyz.candycoded.arfoundation-components v4.0.2

Weekly downloads
13
License
MIT
Repository
github
Last release
2 years ago

ARFoundation Components

📱 Generic components for use with Unity's AR Foundation package

NPM Version

Contents

Installation

https://docs.unity3d.com/Packages/com.unity.package-manager-ui@2.0/manual/index.html

Unity Package Manager

{
  "dependencies": {
    "xyz.candycoded.arfoundation-components": "https://github.com/CandyCoded/ARFoundation-Components.git#v3.2.1",
    "xyz.candycoded.candycoded": "https://github.com/CandyCoded/CandyCoded.git#v3.0.2",
    ...
  }
}

Scoped UPM Registry

{
  "dependencies": {
    "xyz.candycoded.arfoundation-components": "3.2.0",
    "xyz.candycoded.candycoded": "3.0.2",
    ...
  },
  "scopedRegistries": [
    {
      "name": "candycoded",
      "url": "https://registry.npmjs.com",
      "scopes": ["xyz.candycoded"]
    }
  ]
}

Setup

See https://github.com/CandyCoded/ARFoundation-Components-Demo for a working example of the following steps.

Install Dependencies

  1. Install the latest ARKit XR Plugin, ARCore XR Plugin and AR Foundation (preview) packages from the Package Manager.
  2. Install both the ARFoundation Components and CandyCoded package (see above).

Setup AR Foundation

  1. Create a new AR Session Origin gameObject from the Create Asset / XR context menu.
  2. Select the AR Session Origin gameObject and attach the AR Raycast Manager component.
  3. Remove the Main Camera gameObject from the hierarchy (as the AR Session Origin contains its own camera).
  4. Create a new AR Session gameObject from the Create Asset / XR context menu.
  5. Create a new AR Default Plane gameObject from the Create Asset / XR context menu, drag it into the Asset panel creating a prefab and then remove it from the hierarchy.
  6. Attach the AR Plane Manager component to the AR Session Origin gameObject and drag the AR Default Plane prefab from the Assets panel into the Plane Prefab property.
  7. Change the Detection Flags to Horizontal (or whatever plane type you will target).

Setup ARFoundation Components

  1. Select the AR Camera in the AR Session Origin gameObject and change the Light Estimation Mode on the AR Camera Manager component to AmbientIntensity.
  2. Select the Directional Light gameObject and attach the AR Light Estimation component.
  3. Drag the AR Camera component into the Camera Manager property of the AR Light Estimation component.
  4. Attach the AR Plane Events and AR Place Object On Plane components to the AR Session Origin gameObject.
  5. Create a new Cube and set the scale to Vector3(0.1f, 0.1f, 0.1f), drag it into the Asset panel creating a prefab and then remove it from the hierarchy.
  6. Drag the Cube into the Object to Place property of the AR Place Object On Plane component and enable the option Place Multiple.
  7. Create a new event in the Plane Touched with Touch Position event section of the AR Plane Events component.
  8. Drag the AR Session Origin gameObject into the object field of the event.
  9. Select the ARPlaceObjectOnPlane > PlaceObjectOnPlane dynamic method from the dropdown.

Setup iOS build

  1. Check that the scene is in the Build Settings window.
  2. Change the build platform in the Build Settings window to iOS.
  3. In the Player Settings panel, make sure following settings are correct:
SettingValueDescription
Camera Usage DescriptionAR BABY or any other stringThis value will display when the dialog asking for camera permission displays on device.
Target minimum iOS Version11 or higheriOS 11 was the first version ARKit was available.
ArchitectureARM64The only iOS devices that support ARKit are built on ARM64 architecture.

Setup Android build

  1. Check that the scene is in the Build Settings window.
  2. Change the build platform in the Build Settings window to Android.
  3. In the Player Settings panel, make sure following settings are correct:
SettingValueDescription
Graphic APIsOPENGLs3 and remove VulcanARCore does not support Vulcan arcore-android-sdk issue #258
Minimum API levelAndroid 7.0 'Nugget' (API level 24) or higherAndroid 7 was the first version ARCore was available.