Unity MARS is a tool to help kickstart and further support AR development. Read on to explore three specific scenarios and use cases that can make Unity MARS a win for your team's next AR project.

You have a diverse team with various skill sets working in the Unity Editor

Unity MARS brings AR creation right into the Unity Editor. In addition to providing a unique set of samples, theSimulation viewenables drag-and-drop functionality to produce and place AR content, as well as the ability to visualize markers for image tracking-based applications.

If you want to write scripts, Unity MARS is built on top of AR Foundation so that you can access all the unique platform features and functionalities throughprovider interfaces. You can also link directly into MARS components and the MARS query and data API via scripts.

Let's look at two ways to trigger an animation when a MARS object finds a match for its conditions: The first demonstrates how to use the MARS Component Action, whereas the second involves a custom script.

To trigger an animation on match, first add the Match Action MARS component to any proxy object. From there, you can add events for Match Acquired, Updated, Lost and Timedout. In our example, we're linking into the Match Acquired event to store a reference to an animator and set the trigger for Grow.

[Link]

To accomplish the same thing in code, you can store a reference to the proxy component and subscribe to the MatchChanged event. Check the callback to see if the query result is null. If it's not null, this means that a match has been found. From there, you can call SetTrigger on the animator passing through the Trigger Name.

C#
using System; using UnityEngine; using Unity.MARS; using Unity.MARS.Query; public class PlayAnimationOnMatch : MonoBehaviour { [SerializeField] Proxy m_Proxy; [SerializeField] Animator m_Animator; const string k_GrowAnimTrigger = 'Grow'; void OnEnable() { Debug.Assert(m_Proxy != null, 'Proxy reference not set'); m_Proxy.MatchChanged += ProxyOnMatchChanged; } void OnDisable() { Debug.Assert(m_Proxy != null, 'Proxy reference not set'); m_Proxy.MatchChanged -= ProxyOnMatchChanged; } void ProxyOnMatchChanged(QueryResult obj) { if (obj != null) { Debug.Assert(m_Animator != null, 'Animator reference not set'); m_Animator.SetTrigger(k_GrowAnimTrigger); } } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using UnityEngine;
using Unity.MARS;
using Unity.MARS.Query;
public class PlayAnimationOnMatch : MonoBehaviour
{
[SerializeField]
Proxy m_Proxy;
[SerializeField]
Animator m_Animator;
const string k_GrowAnimTrigger = 'Grow';
void OnEnable()
{
Debug.Assert(m_Proxy != null, 'Proxy reference not set');
m_Proxy.MatchChanged += ProxyOnMatchChanged;
}
void OnDisable()
{
Debug.Assert(m_Proxy != null, 'Proxy reference not set');
m_Proxy.MatchChanged -= ProxyOnMatchChanged;
}
void ProxyOnMatchChanged(QueryResult obj)
{
if (obj != null)
{
Debug.Assert(m_Animator != null, 'Animator reference not set');
m_Animator.SetTrigger(k_GrowAnimTrigger);
}
}
}

Here's a look at the script hooked up in the Editor.

[Link]

This example highlights the incredible flexibility that Unity MARS offers developers and non-developers alike. As you can see, both of these users can approach the same task differently, whether they're using specific scripts, or harnessing the MARS interface more exclusively.These workflows empower the creators on your team to work directly in the Unity Editor with Unity MARS.

Your AR experience is based on transforming and interacting with the user's environment

Many AR applications prioritize the placement of digital content in the real world. With Unity MARS, you can do even more thanks to theproxy-based and rules workflows, which allow you to configure the conditions that determine how and where your content appears.

In other words, not only can an app place content in the real world, it can heighten your environment into a much more unique experience. Unity MARS also handles integration with core Unity systems like navmesh and physics within an AR context.

https://blogs.unity3d.com/wp-content/uploads/2021/04/MARS_Rules.mp4


This video shows how different environments, models and textures are spawned based on rules. The models used are from Synty Studios on the Unity Asset Store.

With Unity MARS, you can quickly create content that procedurally spawns in your world based on the different surfaces you've scanned. You can utilize core Unity features in AR more easily with MARS extensions for features like NavMesh, which enables characters to pathfind and move on different surfaces in the real world more fluidly.

You have limited access to the space where your AR app will run

Over the last year, remote work has reached an all-time high. It's now more common than ever to collaborate with teams across the globe, from different locations and time zones. While AR has the capacity to enhance a space, it needs to work seamlessly to feel believable, or like a natural extension of the real world. If you're working on an app that is predicated on a specific location, or you have limited access to certain spaces, theUnity MARS Companionapp (beta) is a great solution for bringing captured AR sessions back into the Unity Editor.

The companion app's AR capture and data recording features let you scan any environment and record surface data, camera paths and videos that can later be imported into Unity MARS and used in Simulation view. The Simulation view in the Editor then allows you to iterate and adjust parameters to better control how and when your content appears.

https://blogs.unity3d.com/wp-content/uploads/2021/04/MARS_MCA_Editor.mp4


See how a capture is imported from the Unity MARS Companion app into Unity Editor. You can then adjust the parameters on the proxy objects and track their changes based on the capture in Simulation view.

Testing and iterating in a location where your app or experience will be used is crucial for creating compelling AR content. With the Unity MARS Companion app, you can record several AR sessions from any location, at any time, and then save to the cloud and import them directly back into the Unity MARS Simulation view, so you don't have to be onsite to see how your content and updates will run.

Get started with Unity MARS

To get started with Unity MARS, try our 45-day trial at no cost. After you start your free trial, be sure to check out 'First Steps in Unity MARS'- a step-by-step course on Unity Learn that unpacks the foundation of the product so you can create an AR application.

Start with your free trial

Attachments

  • Original document
  • Permalink

Disclaimer

Unity Software Inc. published this content on 23 April 2021 and is solely responsible for the information contained therein. Distributed by Public, unedited and unaltered, on 23 April 2021 12:59:03 UTC.