-
Notifications
You must be signed in to change notification settings - Fork 11
API Usage
Last Update: 2020.08.08. Version 1.0
Everything you need is under CardboardManager.cs
All properties are static, public get and private set.
DeviceParams deviceParameter
Decoded cardboard profile, all data are in this object.
bool profileAvailable
True if a cardboard profile is currently available, false if not. It's true in most cases.
bool enableVRView
True if vr view is currently enabled. false if not.
RenderTexture viewTextureLeft, viewTextureRight
RenderTexture
for both eyes, it is set through method SetRenderTexture
, and used in CardboardPostCamera
.
void InitCardboard()
Initialize Cardboard. It enables cardboard head tracker, register qr code scan callback, and initialize cardboard profile.
void SetCardboardProfile(string url)
void SetCardboardInitialProfile(string url)
These 2 methods can be used to set cardboard profile in script. The difference is, SetCardboardProfile
will set cardboard profile directly without checking anything, and SetCardboardInitialProfile
will check if user has initiated a camera scan.
If user has already initiated a camera scan, it will do nothing, otherwise, it will set profile. This value is saved in PlayerPrefs, so once user did a camera scan, this method will do nothing, ever.
This method is created to reimplement the old gvr_set_default_viewer_profile
feature.
Note: if user skip the camera scan, it will still count as "camera scan initiated".
void ScanQrCode()
It initialize scan qr code process. Event deviceParamsChangeEvent
will be triggered when cardboard method is changed.
void RefreshParameters()
Refresh cardboard profile. You don't have to call this manually, because it'll be called automatically when something is changed. It will also trigger deviceParamsChangeEvent
event.
void SetVRViewEnable(bool shouldEnable)
It can be used to enable or disable vr view. enableVRViewChangedEvent
event will be triggered. If you have custom camera script, you have to register this event manually to set correct behaviour.
void RecenterCamera(bool HorizontalOnly = true)
Recenter cardboard camera. If HorizontalOnly
is false, recenter will make camera with current rotation, look at the exact front. If HorizontalOnly
is true, then it will only recenter horizontally, just like other VR does.
Pose GetHeadPose(bool withUpdate = false)
It can be used to get the Pose
of camera. When parameter withUpdate
is true, then a manual CardboardHeadTracker.UpdatePose()
will be called. This method only works on cardboard device, it won't return Editor mockup value.
void SetRenderTexture(RenderTexture newLeft, RenderTexture newRight)
Set render texture so that camera eye textures can be used elsewhere. It shouldn't be called manually unless you have your own camera script. renderTextureResetEvent
event will be triggered.
event Action deviceParamsChangeEvent
It'll be triggered in RefreshParameters
method. The method will be triggered when qr code is scanned, or profile is changed.
event Action renderTextureResetEvent
It'll be triggered in method SetRenderTexture
, which will be called in CardboardMainCamera
.
event Action enableVRViewChangedEvent
It'll be triggered in method SetVRViewEnable
.
- Home
- Package Usage
- API Usage
- Cardboard Profile
- Unity 2019 Note
- Current Development Status
- Build Cardboard SDK for Unity