这款Unity ARKit插件是2019年的最新版本,旨在帮助开发者轻松地将增强现实功能集成到iOS应用中。通过优化性能和增加新的ARKit特性支持,它为创建沉浸式体验提供了强大工具。
Unity ARKit 插件 2.0 包含两个核心文件:
- Assets/Plugins/iOS/UnityARKitNativeInterface/ARSessionNative.mm
- Assets/Plugins/iOS/UnityARKitNativeInterface/UnityARSessionNativeInterface.cs
该插件提供了以下重要 API:
```csharp
public void RunWithConfigAndOptions(ARKitWorldTackingSessionConfiguration config, UnityARSessionRunOption runOptions);
public void RunWithConfig(ARKitWorldTackingSessionConfiguration config);
public void Pause();
public List HitTest(ARPoint point, ARHitTestResultType types);
public ARTextureHandles GetARVideoTextureHandles();
public float GetARAmbientIntensity();
public int GetARTrackingQuality();
```
还包含以下委托:
```csharp
public delegate void ARFrameUpdate(UnityARCamera camera);
public delegate void ARAnchorAdded(ARPlaneAnchor anchorData);
public delegate void ARAnchorUpdated(ARPlaneAnchor anchorData);
public delegate void ARAnchorRemoved(ARPlaneAnchor anchorData);
public delegate void ARSessionFailed(string error);
```
还有一些回调事件:
```csharp
public static event ARFrameUpdate ARFrameUpdatedEvent;
public static event ARAnchorAdded ARAnchorAddedEvent;
public static event ARAnchorUpdated ARAnchorUpdatedEvent;
public static event ARAnchorRemoved ARAnchorRemovedEvent;
public static event ARAnchorAdded ARUserAnchorAddedEvent;
public static event ARAnchorUpdated ARUserAnchorUpdatedEvent;
public static event ARAnchorRemoved ARUserAnchorRemovedEvent;
public static event ARSessionCallback ARSessionInterruptedEvent;
public static event ARSessionCallback ARSessioninterruptionEndedEvent;
public static event ARSessionTrackingChanged ARSessionTrackingChangedEvent;
```