Skip to content

Commit

Permalink
2.0.1 - 2019/03/15
Browse files Browse the repository at this point in the history
@2019.2
  • Loading branch information
ErikMoczi committed Mar 19, 2019
1 parent e3a4123 commit 10a5c4f
Show file tree
Hide file tree
Showing 117 changed files with 6,862 additions and 6,676 deletions.
265 changes: 137 additions & 128 deletions package/CHANGELOG.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package/CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

514 changes: 272 additions & 242 deletions package/Documentation~/com.unity.xr.arfoundation.md

Large diffs are not rendered by default.

Binary file modified package/Documentation~/images/ar_session.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 100 additions & 100 deletions package/Documentation~/migration-guide.md
@@ -1,100 +1,100 @@
# Migration Guide

This will guide you through the changes coming from AR Foundation 1.0

## TL;DR

* Add an `ARInputManager` anywhere in your scene.
* Add an `ARCameraManager` to your AR camera (this replaces the `ARCameraOptions`).
* Raycast via the `ARRaycastManager` instead of the `ARSessionOrigin`
* Some `TryGet`/`TryAdd`/`TryRemove` APIs were renamed to just `Get`/`Add`/`Remove`
* `GetAllXXX` is now a `trackables` property
* Added, update, and removed events have been combined into a single event that gives you lists of all the added, updated, and removed trackables.

## Events

In 1.0, each trackable manager provided added, updated, and removed events for each trackable. In 2.0, each trackable manager has a single event invoked no more than once per frame containing all the changes (added, updated, and removed) since the last frame.

**Example:**

| 1.0 | 2.0 |
|-|-|
| `ARPlaneManager.planeAdded`, `ARPlaneManager.planeUpdated`, `ARPlaneManager.planeRemoved` | `ARPlaneManager.planesChanged` |

## Session Relative Data

Many of the trackables in AR Foundation 1.0 had "session relative data", e.g., `BoundedPlane` and `XRReferencePoint`. These are no longer directly accessible; all their memebers are now properties of an AR Foundation trackable.

**Example:**

| Trackable | 1.0 accessor | 2.0 accessor |
|-|-|-|
|`ARPlane`|`boundedPlane.Id`|`trackableId`|

## Removed Try

Several APIs used a `TryGet` or `TryAdd` style of API. Such methods that dealt with reference types have dropped the `Try` prefix.

**Examples:**

| 1.0 | 2.0 |
|-|-|
| `ARPlane.TryGetPlane(trackableId)` | `ARPlane.GetPlane(trackableId)` |
| `ARReferencePoint.TryAddReferencePoint` | `ARReferencePoint.AddReferencePoint` |
| `ARReferencePoint.TryAttachReferencePoint` | `ARReferencePoint.AttachReferencePoint` |
| `bool ARReferencePoint.TryRemoveReferencePoint` | `bool ARReferencePoint.RemoveReferencePoint` |

## Enumerating Trackables

Trackable managers previously had a way to obtain a `List` of all trackables, e.g., `ARPlaneManager.GetAllPlanes` and `ARReferencePointManager.GetAllReferencePoints`. There is now a common property called `trackables`, which can be used in a `foreach`, e.g.:

```csharp
var planeManager = GetComponent<ARPlaneManager>();
foreach (var plane in planeManager.trackables) {
// Do something with the plane
}
```

This property returns a `TrackablesCollection` which does not generate any garbage or cause boxing.

## ARSubsystemManager Removed

The `ARSubsystemManager` has been removed in 2.0. It was previously a singleton which provided access to each of the "subsystems" (the low-level interface to the AR platform). However, some subsystems were also simultaneously managed by a `MonoBehavior`, e.g., `ARPlaneManager`.

The led to confusion about which object to interact with or subscribe to. Now, each "subsystem" has a manager component which not only provides access to that subsystem, but also manages its lifetime.

If you previously used the `ARSubsystemManager`, look for similar functionality on one of the managers:

| 1.0 Subsystem | 2.0 Manager |
|-|-|
| `XRPlaneSubsystem` | `ARPlaneManager` |
| `XRReferencePointSubsystem` | `ARReferencePointManager` |
| `XRDepthSubsystem` | `ARPointCloudManager` |
| `XRSessionSubsystem` | `ARSession` |
| `XRInputSubsystem` | `ARInputManager` (new) |
| `XRCameraSubsystem` | `ARCameraManager` (new) |
| `XRRaycastSubsystem` | `ARRaycastManager` (new) |

## ARInputManager

Previously, pose tracking was implicitly always on. Now, you must have an `ARInputManager` component in your scene to enable it. It does not matter what `GameObject` this is on.

The `ARInputManager` enables input tracking; the `TrackedPoseDriver` consumes pose data (as before).

## ARCameraManager and ARCameraOptions

The `ARCameraManager` enables the `XRCameraSubsystem`; without it, you will not be able to use background rendering or obtain light estimation information. This component should be placed on a Unity Camera, usually on the same one that is parented to the `ARSessionOrigin` and performs background rendering.

The `ARCameraBackground` now requires an `ARCameraManager` component.

The options that were previously on the `ARCameraOptions` component, like focus mode and light estimation mode, are now on the `ARCameraManager`. The `ARCameraOptions` no longer exists.

## ARPointCloudManager

In 1.0, the `ARPointCloudManager` managed a single point cloud. Now, it can manage a collection of them, similar to the way other trackable managers work. Some AR platforms, like ARCore and ARKit, still only have a single point cloud. However, other platforms (supported in the future) will generate multiple point clouds.

As a result, the `ARPointCloudManager.pointCloud` property no longer exists. You can enumerate the point clouds like any other trackable manager, by iterating over its `trackables` property.

## ARRaycastManager

The raycasting API is the same as before, only now it is on a new component `ARRaycastManager`. Previously it was on the `ARSessionOrigin`. If you need to perform a raycast, make sure you have a `ARRaycastManager` on the same `GameObject` as the `ARSessionOrigin` and use the `Raycast` methods on that component.
# Migration Guide

This will guide you through the changes coming from AR Foundation 1.0

## TL;DR

* Add an `ARInputManager` anywhere in your scene.
* Add an `ARCameraManager` to your AR camera (this replaces the `ARCameraOptions`).
* Raycast via the `ARRaycastManager` instead of the `ARSessionOrigin`
* Some `TryGet`/`TryAdd`/`TryRemove` APIs were renamed to just `Get`/`Add`/`Remove`
* `GetAllXXX` is now a `trackables` property
* Added, update, and removed events have been combined into a single event that gives you lists of all the added, updated, and removed trackables.

## Events

In 1.0, each trackable manager provided added, updated, and removed events for each trackable. In 2.0, each trackable manager has a single event invoked no more than once per frame containing all the changes (added, updated, and removed) since the last frame.

**Example:**

| 1.0 | 2.0 |
|-|-|
| `ARPlaneManager.planeAdded`, `ARPlaneManager.planeUpdated`, `ARPlaneManager.planeRemoved` | `ARPlaneManager.planesChanged` |

## Session Relative Data

Many of the trackables in AR Foundation 1.0 had "session relative data", e.g., `BoundedPlane` and `XRReferencePoint`. These are no longer directly accessible; all their memebers are now properties of an AR Foundation trackable.

**Example:**

| Trackable | 1.0 accessor | 2.0 accessor |
|-|-|-|
|`ARPlane`|`boundedPlane.Id`|`trackableId`|

## Removed Try

Several APIs used a `TryGet` or `TryAdd` style of API. Such methods that dealt with reference types have dropped the `Try` prefix.

**Examples:**

| 1.0 | 2.0 |
|-|-|
| `ARPlane.TryGetPlane(trackableId)` | `ARPlane.GetPlane(trackableId)` |
| `ARReferencePoint.TryAddReferencePoint` | `ARReferencePoint.AddReferencePoint` |
| `ARReferencePoint.TryAttachReferencePoint` | `ARReferencePoint.AttachReferencePoint` |
| `bool ARReferencePoint.TryRemoveReferencePoint` | `bool ARReferencePoint.RemoveReferencePoint` |

## Enumerating Trackables

Trackable managers previously had a way to obtain a `List` of all trackables, e.g., `ARPlaneManager.GetAllPlanes` and `ARReferencePointManager.GetAllReferencePoints`. There is now a common property called `trackables`, which can be used in a `foreach`, e.g.:

```csharp
var planeManager = GetComponent<ARPlaneManager>();
foreach (var plane in planeManager.trackables) {
// Do something with the plane
}
```

This property returns a `TrackablesCollection` which does not generate any garbage or cause boxing.

## ARSubsystemManager Removed

The `ARSubsystemManager` has been removed in 2.0. It was previously a singleton which provided access to each of the "subsystems" (the low-level interface to the AR platform). However, some subsystems were also simultaneously managed by a `MonoBehavior`, e.g., `ARPlaneManager`.

The led to confusion about which object to interact with or subscribe to. Now, each "subsystem" has a manager component which not only provides access to that subsystem, but also manages its lifetime.

If you previously used the `ARSubsystemManager`, look for similar functionality on one of the managers:

| 1.0 Subsystem | 2.0 Manager |
|-|-|
| `XRPlaneSubsystem` | `ARPlaneManager` |
| `XRReferencePointSubsystem` | `ARReferencePointManager` |
| `XRDepthSubsystem` | `ARPointCloudManager` |
| `XRSessionSubsystem` | `ARSession` |
| `XRInputSubsystem` | `ARInputManager` (new) |
| `XRCameraSubsystem` | `ARCameraManager` (new) |
| `XRRaycastSubsystem` | `ARRaycastManager` (new) |

## ARInputManager

Previously, pose tracking was implicitly always on. Now, you must have an `ARInputManager` component in your scene to enable it. It does not matter what `GameObject` this is on.

The `ARInputManager` enables input tracking; the `TrackedPoseDriver` consumes pose data (as before).

## ARCameraManager and ARCameraOptions

The `ARCameraManager` enables the `XRCameraSubsystem`; without it, you will not be able to use background rendering or obtain light estimation information. This component should be placed on a Unity Camera, usually on the same one that is parented to the `ARSessionOrigin` and performs background rendering.

The `ARCameraBackground` now requires an `ARCameraManager` component.

The options that were previously on the `ARCameraOptions` component, like focus mode and light estimation mode, are now on the `ARCameraManager`. The `ARCameraOptions` no longer exists.

## ARPointCloudManager

In 1.0, the `ARPointCloudManager` managed a single point cloud. Now, it can manage a collection of them, similar to the way other trackable managers work. Some AR platforms, like ARCore and ARKit, still only have a single point cloud. However, other platforms (supported in the future) will generate multiple point clouds.

As a result, the `ARPointCloudManager.pointCloud` property no longer exists. You can enumerate the point clouds like any other trackable manager, by iterating over its `trackables` property.

## ARRaycastManager

The raycasting API is the same as before, only now it is on a new component `ARRaycastManager`. Previously it was on the `ARSessionOrigin`. If you need to perform a raycast, make sure you have a `ARRaycastManager` on the same `GameObject` as the `ARSessionOrigin` and use the `Raycast` methods on that component.
16 changes: 8 additions & 8 deletions package/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

142 changes: 71 additions & 71 deletions package/Editor/ARCameraBackgroundEditor.cs
@@ -1,71 +1,71 @@
using UnityEngine;
using UnityEngine.XR.ARFoundation;

namespace UnityEditor.XR.ARFoundation
{
[CustomEditor(typeof(ARCameraBackground))]
internal class ARCameraBackgroundEditor : Editor
{
SerializedProperty m_UseCustomMaterial;

SerializedProperty m_CustomMaterial;

SerializedProperty m_UseCustomRendererAsset;

SerializedProperty m_CustomRendererAsset;

static class Tooltips
{
public static readonly GUIContent useCustomMaterial = new GUIContent(
"Use Custom Material",
"When false, a material is generated automatically from the shader included in the platform-specific package. When true, the Custom Material is used instead, overriding the automatically generated one. This is not necessary for most AR experiences.");

public static readonly GUIContent customMaterial = new GUIContent(
"Custom Material",
"The material to use for background rendering.");

public static readonly GUIContent useCustomRendererAsset = new GUIContent(
"Use Custom Renderer Asset",
"When false, default background renderer is used. When true, the Custom Render Asset is used to generate a background renderer, overriding the default one.");

public static readonly GUIContent customRendererAsset = new GUIContent(
"Custom Renderer Asset",
"The Render Asset to use to create background renderer.");


}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.PropertyField(m_UseCustomMaterial, Tooltips.useCustomMaterial);

if (m_UseCustomMaterial.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_CustomMaterial, Tooltips.customMaterial);
EditorGUI.indentLevel--;
}

EditorGUILayout.PropertyField(m_UseCustomRendererAsset, Tooltips.useCustomRendererAsset);

if (m_UseCustomRendererAsset.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_CustomRendererAsset, Tooltips.customRendererAsset);
EditorGUI.indentLevel--;
}

serializedObject.ApplyModifiedProperties();
}

void OnEnable()
{
m_UseCustomMaterial = serializedObject.FindProperty("m_UseCustomMaterial");
m_CustomMaterial = serializedObject.FindProperty("m_CustomMaterial");
m_UseCustomRendererAsset = serializedObject.FindProperty("m_UseCustomRendererAsset");
m_CustomRendererAsset = serializedObject.FindProperty("m_CustomRendererAsset");
}
}
}
using UnityEngine;
using UnityEngine.XR.ARFoundation;

namespace UnityEditor.XR.ARFoundation
{
[CustomEditor(typeof(ARCameraBackground))]
internal class ARCameraBackgroundEditor : Editor
{
SerializedProperty m_UseCustomMaterial;

SerializedProperty m_CustomMaterial;

SerializedProperty m_UseCustomRendererAsset;

SerializedProperty m_CustomRendererAsset;

static class Tooltips
{
public static readonly GUIContent useCustomMaterial = new GUIContent(
"Use Custom Material",
"When false, a material is generated automatically from the shader included in the platform-specific package. When true, the Custom Material is used instead, overriding the automatically generated one. This is not necessary for most AR experiences.");

public static readonly GUIContent customMaterial = new GUIContent(
"Custom Material",
"The material to use for background rendering.");

public static readonly GUIContent useCustomRendererAsset = new GUIContent(
"Use Custom Renderer Asset",
"When false, default background renderer is used. When true, the Custom Render Asset is used to generate a background renderer, overriding the default one.");

public static readonly GUIContent customRendererAsset = new GUIContent(
"Custom Renderer Asset",
"The Render Asset to use to create background renderer.");


}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.PropertyField(m_UseCustomMaterial, Tooltips.useCustomMaterial);

if (m_UseCustomMaterial.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_CustomMaterial, Tooltips.customMaterial);
EditorGUI.indentLevel--;
}

EditorGUILayout.PropertyField(m_UseCustomRendererAsset, Tooltips.useCustomRendererAsset);

if (m_UseCustomRendererAsset.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_CustomRendererAsset, Tooltips.customRendererAsset);
EditorGUI.indentLevel--;
}

serializedObject.ApplyModifiedProperties();
}

void OnEnable()
{
m_UseCustomMaterial = serializedObject.FindProperty("m_UseCustomMaterial");
m_CustomMaterial = serializedObject.FindProperty("m_CustomMaterial");
m_UseCustomRendererAsset = serializedObject.FindProperty("m_UseCustomRendererAsset");
m_CustomRendererAsset = serializedObject.FindProperty("m_CustomRendererAsset");
}
}
}
22 changes: 11 additions & 11 deletions package/Editor/ARCameraBackgroundEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 10a5c4f

Please sign in to comment.