| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!21 &2100000 | ||
| Material: | ||
| serializedVersion: 6 | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_Name: PawnTranslucent | ||
| m_Shader: {fileID: 10721, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_ShaderKeywords: | ||
| m_LightmapFlags: 4 | ||
| m_EnableInstancingVariants: 0 | ||
| m_DoubleSidedGI: 0 | ||
| m_CustomRenderQueue: -1 | ||
| stringTagMap: {} | ||
| disabledShaderPasses: [] | ||
| m_SavedProperties: | ||
| serializedVersion: 3 | ||
| m_TexEnvs: | ||
| - _BumpMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _DetailAlbedoMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _DetailMask: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _DetailNormalMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _EmissionMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _MainTex: | ||
| m_Texture: {fileID: 2800000, guid: 34437b0148f014726a3e848394ccd3ce, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _MetallicGlossMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _OcclusionMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _ParallaxMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| m_Floats: | ||
| - _BumpScale: 1 | ||
| - _ColorMask: 15 | ||
| - _Cutoff: 0.5 | ||
| - _DetailNormalMapScale: 1 | ||
| - _DstBlend: 0 | ||
| - _GlossMapScale: 1 | ||
| - _Glossiness: 0.5 | ||
| - _GlossyReflections: 1 | ||
| - _Metallic: 0 | ||
| - _Mode: 0 | ||
| - _OcclusionStrength: 1 | ||
| - _Parallax: 0.02 | ||
| - _SmoothnessTextureChannel: 0 | ||
| - _SpecularHighlights: 1 | ||
| - _SrcBlend: 1 | ||
| - _Stencil: 0 | ||
| - _StencilComp: 8 | ||
| - _StencilOp: 0 | ||
| - _StencilReadMask: 255 | ||
| - _StencilWriteMask: 255 | ||
| - _UVSec: 0 | ||
| - _UseUIAlphaClip: 0 | ||
| - _ZWrite: 1 | ||
| m_Colors: | ||
| - _Color: {r: 1, g: 1, b: 1, a: 0.559} | ||
| - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} | ||
| - _Specular: {r: 0, g: 0, b: 0, a: 0} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,234 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!1001 &100100000 | ||
| Prefab: | ||
| m_ObjectHideFlags: 1 | ||
| serializedVersion: 2 | ||
| m_Modification: | ||
| m_TransformParent: {fileID: 0} | ||
| m_Modifications: [] | ||
| m_RemovedComponents: [] | ||
| m_ParentPrefab: {fileID: 0} | ||
| m_RootGameObject: {fileID: 1982771189949738} | ||
| m_IsPrefabParent: 1 | ||
| --- !u!1 &1706911323541906 | ||
| GameObject: | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| serializedVersion: 5 | ||
| m_Component: | ||
| - component: {fileID: 4808475426170338} | ||
| - component: {fileID: 33885700989680310} | ||
| - component: {fileID: 23604301657640070} | ||
| - component: {fileID: 64612585084049688} | ||
| - component: {fileID: 114029948001014002} | ||
| m_Layer: 0 | ||
| m_Name: ARCore_pawn | ||
| m_TagString: Untagged | ||
| m_Icon: {fileID: 0} | ||
| m_NavMeshLayer: 0 | ||
| m_StaticEditorFlags: 0 | ||
| m_IsActive: 1 | ||
| --- !u!1 &1752685467971502 | ||
| GameObject: | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| serializedVersion: 5 | ||
| m_Component: | ||
| - component: {fileID: 4429535725600738} | ||
| - component: {fileID: 33261814464523216} | ||
| - component: {fileID: 23402302240547484} | ||
| m_Layer: 0 | ||
| m_Name: ShadowQuad | ||
| m_TagString: Untagged | ||
| m_Icon: {fileID: 0} | ||
| m_NavMeshLayer: 0 | ||
| m_StaticEditorFlags: 0 | ||
| m_IsActive: 1 | ||
| --- !u!1 &1982771189949738 | ||
| GameObject: | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| serializedVersion: 5 | ||
| m_Component: | ||
| - component: {fileID: 4332297762598494} | ||
| - component: {fileID: 114451545527201010} | ||
| m_Layer: 0 | ||
| m_Name: ARCoreInstantPlacementPawn | ||
| m_TagString: Untagged | ||
| m_Icon: {fileID: 0} | ||
| m_NavMeshLayer: 0 | ||
| m_StaticEditorFlags: 0 | ||
| m_IsActive: 1 | ||
| --- !u!4 &4332297762598494 | ||
| Transform: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1982771189949738} | ||
| m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
| m_LocalPosition: {x: 0, y: 0, z: 0} | ||
| m_LocalScale: {x: 1, y: 1, z: 1} | ||
| m_Children: | ||
| - {fileID: 4808475426170338} | ||
| - {fileID: 4429535725600738} | ||
| m_Father: {fileID: 0} | ||
| m_RootOrder: 0 | ||
| m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
| --- !u!4 &4429535725600738 | ||
| Transform: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1752685467971502} | ||
| m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} | ||
| m_LocalPosition: {x: 0, y: 0, z: 0} | ||
| m_LocalScale: {x: 0.4, y: 0.4, z: 0.4} | ||
| m_Children: [] | ||
| m_Father: {fileID: 4332297762598494} | ||
| m_RootOrder: 1 | ||
| m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} | ||
| --- !u!4 &4808475426170338 | ||
| Transform: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1706911323541906} | ||
| m_LocalRotation: {x: 6.123234e-17, y: 1, z: 6.123234e-17, w: -6.123234e-17} | ||
| m_LocalPosition: {x: 0, y: 0, z: 0} | ||
| m_LocalScale: {x: 1, y: 1, z: 1} | ||
| m_Children: [] | ||
| m_Father: {fileID: 4332297762598494} | ||
| m_RootOrder: 0 | ||
| m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
| --- !u!23 &23402302240547484 | ||
| MeshRenderer: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1752685467971502} | ||
| m_Enabled: 1 | ||
| m_CastShadows: 1 | ||
| m_ReceiveShadows: 1 | ||
| m_DynamicOccludee: 1 | ||
| m_MotionVectors: 1 | ||
| m_LightProbeUsage: 1 | ||
| m_ReflectionProbeUsage: 1 | ||
| m_Materials: | ||
| - {fileID: 2100000, guid: 1543111f52ced4f468b402fcf46b850a, type: 2} | ||
| m_StaticBatchInfo: | ||
| firstSubMesh: 0 | ||
| subMeshCount: 0 | ||
| m_StaticBatchRoot: {fileID: 0} | ||
| m_ProbeAnchor: {fileID: 0} | ||
| m_LightProbeVolumeOverride: {fileID: 0} | ||
| m_ScaleInLightmap: 1 | ||
| m_PreserveUVs: 1 | ||
| m_IgnoreNormalsForChartDetection: 0 | ||
| m_ImportantGI: 0 | ||
| m_StitchLightmapSeams: 0 | ||
| m_SelectedEditorRenderState: 3 | ||
| m_MinimumChartSize: 4 | ||
| m_AutoUVMaxDistance: 0.5 | ||
| m_AutoUVMaxAngle: 89 | ||
| m_LightmapParameters: {fileID: 0} | ||
| m_SortingLayerID: 0 | ||
| m_SortingLayer: 0 | ||
| m_SortingOrder: 0 | ||
| --- !u!23 &23604301657640070 | ||
| MeshRenderer: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1706911323541906} | ||
| m_Enabled: 1 | ||
| m_CastShadows: 1 | ||
| m_ReceiveShadows: 1 | ||
| m_DynamicOccludee: 1 | ||
| m_MotionVectors: 1 | ||
| m_LightProbeUsage: 1 | ||
| m_ReflectionProbeUsage: 1 | ||
| m_Materials: | ||
| - {fileID: 2100000, guid: 323489e10f1294dc09fbdd17ce5eddbd, type: 2} | ||
| - {fileID: 2100000, guid: 70896cee61b874ab4bf0c86e9192ba57, type: 2} | ||
| - {fileID: 2100000, guid: 497ba9ca2875647c480e107fef5391be, type: 2} | ||
| m_StaticBatchInfo: | ||
| firstSubMesh: 0 | ||
| subMeshCount: 0 | ||
| m_StaticBatchRoot: {fileID: 0} | ||
| m_ProbeAnchor: {fileID: 0} | ||
| m_LightProbeVolumeOverride: {fileID: 0} | ||
| m_ScaleInLightmap: 1 | ||
| m_PreserveUVs: 0 | ||
| m_IgnoreNormalsForChartDetection: 0 | ||
| m_ImportantGI: 0 | ||
| m_StitchLightmapSeams: 0 | ||
| m_SelectedEditorRenderState: 3 | ||
| m_MinimumChartSize: 4 | ||
| m_AutoUVMaxDistance: 0.5 | ||
| m_AutoUVMaxAngle: 89 | ||
| m_LightmapParameters: {fileID: 0} | ||
| m_SortingLayerID: 0 | ||
| m_SortingLayer: 0 | ||
| m_SortingOrder: 0 | ||
| --- !u!33 &33261814464523216 | ||
| MeshFilter: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1752685467971502} | ||
| m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} | ||
| --- !u!33 &33885700989680310 | ||
| MeshFilter: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1706911323541906} | ||
| m_Mesh: {fileID: 4300000, guid: f84456e53845d45738b1156787e9a29a, type: 3} | ||
| --- !u!64 &64612585084049688 | ||
| MeshCollider: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1706911323541906} | ||
| m_Material: {fileID: 0} | ||
| m_IsTrigger: 0 | ||
| m_Enabled: 1 | ||
| serializedVersion: 3 | ||
| m_Convex: 0 | ||
| m_CookingOptions: 14 | ||
| m_SkinWidth: 0.01 | ||
| m_Mesh: {fileID: 4300000, guid: f84456e53845d45738b1156787e9a29a, type: 3} | ||
| --- !u!114 &114029948001014002 | ||
| MonoBehaviour: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1706911323541906} | ||
| m_Enabled: 1 | ||
| m_EditorHideFlags: 0 | ||
| m_Script: {fileID: 11500000, guid: 94237db27a0a14e2094a1f08474520ba, type: 3} | ||
| m_Name: | ||
| m_EditorClassIdentifier: | ||
| HolographicMaterials: | ||
| - {fileID: 2100000, guid: 1128ebe9a8e984da085c9c3e31c69d76, type: 2} | ||
| - {fileID: 2100000, guid: 1128ebe9a8e984da085c9c3e31c69d76, type: 2} | ||
| - {fileID: 2100000, guid: 1128ebe9a8e984da085c9c3e31c69d76, type: 2} | ||
| OriginalMaterials: | ||
| - {fileID: 2100000, guid: 323489e10f1294dc09fbdd17ce5eddbd, type: 2} | ||
| - {fileID: 2100000, guid: 70896cee61b874ab4bf0c86e9192ba57, type: 2} | ||
| - {fileID: 2100000, guid: 497ba9ca2875647c480e107fef5391be, type: 2} | ||
| --- !u!114 &114451545527201010 | ||
| MonoBehaviour: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 1982771189949738} | ||
| m_Enabled: 1 | ||
| m_EditorHideFlags: 0 | ||
| m_Script: {fileID: 11500000, guid: f6299f95305af49f0a80367409d4ae26, type: 3} | ||
| m_Name: | ||
| m_EditorClassIdentifier: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| //----------------------------------------------------------------------- | ||
| // <copyright file="InstantPlacementEffect.cs" company="Google LLC"> | ||
| // | ||
| // Copyright 2020 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // </copyright> | ||
| //----------------------------------------------------------------------- | ||
|
|
||
| namespace GoogleARCore.Examples.Common | ||
| { | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| /// <summary> | ||
| /// A component that controls holographic effect on a game object that relies on | ||
| /// Instant Placement. | ||
| /// </summary> | ||
| [RequireComponent(typeof(MeshRenderer))] | ||
| public class InstantPlacementEffect : MonoBehaviour | ||
| { | ||
| /// <summary> | ||
| /// The transparent materials and the size should match the original materials. | ||
| /// </summary> | ||
| public Material[] HolographicMaterials; | ||
|
|
||
| /// <summary> | ||
| /// The origianl materials used by this game object. | ||
| /// </summary> | ||
| public Material[] OriginalMaterials; | ||
|
|
||
| private bool _isOn = false; | ||
|
|
||
| private InstantPlacementPoint _instantPlacementPoint = null; | ||
|
|
||
| /// <summary> | ||
| /// Initialize the visual effect. | ||
| /// </summary> | ||
| /// <param name="trackable">The Trackable that's associated to this object.</param> | ||
| public void InitializeWithTrackable(Trackable trackable) | ||
| { | ||
| if (trackable is InstantPlacementPoint) | ||
| { | ||
| _instantPlacementPoint = trackable as InstantPlacementPoint; | ||
| _isOn = _instantPlacementPoint.TrackingMethod != | ||
| InstantPlacementPointTrackingMethod.FullTracking; | ||
| } | ||
| else | ||
| { | ||
| _isOn = false; | ||
| } | ||
|
|
||
| if (_isOn) | ||
| { | ||
| var renderer = GetComponent<MeshRenderer>(); | ||
| renderer.materials = HolographicMaterials; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The Unity Update() method. | ||
| /// </summary> | ||
| public void Update() | ||
| { | ||
| if (!_isOn || _instantPlacementPoint == null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| if (_instantPlacementPoint.TrackingMethod == | ||
| InstantPlacementPointTrackingMethod.FullTracking) | ||
| { | ||
| GetComponent<MeshRenderer>().materials = OriginalMaterials; | ||
| _isOn = false; | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| //----------------------------------------------------------------------- | ||
| // <copyright file="InstantPlacementMenu.cs" company="Google LLC"> | ||
| // | ||
| // Copyright 2020 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // </copyright> | ||
| //----------------------------------------------------------------------- | ||
|
|
||
| namespace GoogleARCore.Examples.Common | ||
| { | ||
| using UnityEngine; | ||
| using UnityEngine.UI; | ||
|
|
||
| /// <summary> | ||
| /// Instant placement setting menu to configure instant placement options in runtime. | ||
| /// </summary> | ||
| public class InstantPlacementMenu : MonoBehaviour | ||
| { | ||
| /// <summary> | ||
| /// The ARCoreSession component used in this scene. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private ARCoreSession _arCoreSession = null; | ||
|
|
||
| /// <summary> | ||
| /// Toggle element to configure instant placement mode in runtime. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private Toggle _instantPlacementToggle = null; | ||
|
|
||
| /// <summary> | ||
| /// The button to apply current settings. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private Button _applyButton = null; | ||
|
|
||
| /// <summary> | ||
| /// The button to reset current settings. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private Button _cancelButton = null; | ||
|
|
||
| /// <summary> | ||
| /// Unity's Start() method. | ||
| /// </summary> | ||
| public void Start() | ||
| { | ||
| _applyButton.onClick.AddListener(ApplySettings); | ||
| _cancelButton.onClick.AddListener(ResetSettings); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Unity's OnDestroy() method. | ||
| /// </summary> | ||
| public void OnDestroy() | ||
| { | ||
| _applyButton.onClick.RemoveListener(ApplySettings); | ||
| _cancelButton.onClick.RemoveListener(ResetSettings); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Check whether Instant Placement is current enabled. | ||
| /// </summary> | ||
| /// <returns><c>true</c> when Instant Placement is enabled, | ||
| /// otherwise, returns <c>false</c>.</returns> | ||
| public bool IsInstantPlacementEnabled() | ||
| { | ||
| return _arCoreSession.SessionConfig.InstantPlacementMode != | ||
| InstantPlacementMode.Disabled; | ||
| } | ||
|
|
||
| private void ApplySettings() | ||
| { | ||
| if (_instantPlacementToggle == null || _arCoreSession == null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| var instantPlacementMode = _instantPlacementToggle.isOn ? | ||
| InstantPlacementMode.LocalYUp : InstantPlacementMode.Disabled; | ||
| _arCoreSession.SessionConfig.InstantPlacementMode = instantPlacementMode; | ||
| } | ||
|
|
||
| private void ResetSettings() | ||
| { | ||
| if (_instantPlacementToggle == null || _arCoreSession == null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| _instantPlacementToggle.isOn = | ||
| _arCoreSession.SessionConfig.InstantPlacementMode != InstantPlacementMode.Disabled; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,4 +19,4 @@ MonoBehaviour: | |
| CameraFocusMode: 1 | ||
| AugmentedFaceMode: 0 | ||
| DepthMode: 1 | ||
| InstantPlacementMode: 2 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| //----------------------------------------------------------------------- | ||
| // <copyright file="SettingsMenu.cs" company="Google LLC"> | ||
| // | ||
| // Copyright 2020 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // </copyright> | ||
| //----------------------------------------------------------------------- | ||
|
|
||
| namespace GoogleARCore.Examples.HelloAR | ||
| { | ||
| using GoogleARCore.Examples.Common; | ||
| using UnityEngine; | ||
| using UnityEngine.UI; | ||
|
|
||
| /// <summary> | ||
| /// Setting menu for Hello AR Sample, including settings for different features. | ||
| /// </summary> | ||
| public class SettingsMenu : MonoBehaviour | ||
| { | ||
| [Header("Common Settings")] | ||
|
|
||
| /// <summary> | ||
| /// Scene object that contains all setting menu UI elements. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private GameObject _menuWindow = null; | ||
|
|
||
| /// <summary> | ||
| /// Setting menu that contains options for different features. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private GameObject _settingMenuUi = null; | ||
|
|
||
| /// <summary> | ||
| /// Setting button for opening menu windows. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private Button _settingButton = null; | ||
|
|
||
| /// <summary> | ||
| /// The plane discovery guide visuals that guide users to scan surroundings | ||
| /// and discover planes. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private PlaneDiscoveryGuide _planeDiscoveryGuide = null; | ||
|
|
||
| [Header("Depth Settings")] | ||
|
|
||
| /// <summary> | ||
| /// Depth setting menu that is used for configuring depth options. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private GameObject _depthMenuUi = null; | ||
|
|
||
| /// <summary> | ||
| /// The button to open depth menu. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private Button _depthButton = null; | ||
|
|
||
| /// <summary> | ||
| /// The component to control depth menu. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private DepthMenu _depthMenu = null; | ||
|
|
||
| [Header("Instant Placement Settings")] | ||
|
|
||
| /// <summary> | ||
| /// Instant Placement menu for configuring instant placement options. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private GameObject _instantPlacementMenuUi = null; | ||
|
|
||
| /// <summary> | ||
| /// The button to open instant placement menu. | ||
| /// </summary> | ||
| [SerializeField] | ||
| private Button _instantPlacementButton = null; | ||
|
|
||
| /// <summary> | ||
| /// Unity's Start() method. | ||
| /// </summary> | ||
| public void Start() | ||
| { | ||
| _menuWindow.SetActive(false); | ||
| _settingMenuUi.SetActive(false); | ||
| _settingButton.onClick.AddListener(OnMenuButtonClick); | ||
|
|
||
| _depthMenuUi.SetActive(false); | ||
| _depthButton.onClick.AddListener(OnClickDepthMenu); | ||
| _instantPlacementMenuUi.SetActive(false); | ||
| _instantPlacementButton.onClick.AddListener(OnClickInstantPlacementMenu); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Unity's OnDestroy() method. | ||
| /// </summary> | ||
| public void OnDestroy() | ||
| { | ||
| _settingButton.onClick.RemoveListener(OnMenuButtonClick); | ||
| _depthButton.onClick.RemoveListener(OnClickDepthMenu); | ||
| _instantPlacementButton.onClick.RemoveListener(OnClickInstantPlacementMenu); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Callback event for closing the setting menu. | ||
| /// </summary> | ||
| public void OnMenuClosed() | ||
| { | ||
| _menuWindow.SetActive(false); | ||
| _settingMenuUi.SetActive(false); | ||
| _depthMenuUi.SetActive(false); | ||
| _instantPlacementMenuUi.SetActive(false); | ||
| _planeDiscoveryGuide.EnablePlaneDiscoveryGuide(true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Callback event for option button. | ||
| /// </summary> | ||
| private void OnMenuButtonClick() | ||
| { | ||
| _menuWindow.SetActive(true); | ||
| #if ARCORE_FEATURE_INSTANT_PLACEMENT // Both Dpeth and IP are enabled. | ||
| _settingMenuUi.SetActive(true); | ||
| #else // Only Depth is enabled. | ||
| _depthMenuUi.SetActive(true); | ||
| _depthMenu.OnMenuButtonClicked(); | ||
| #endif | ||
| _planeDiscoveryGuide.EnablePlaneDiscoveryGuide(false); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Callback event for opening depth menu. | ||
| /// </summary> | ||
| private void OnClickDepthMenu() | ||
| { | ||
| _settingMenuUi.SetActive(false); | ||
| _depthMenuUi.SetActive(true); | ||
| _depthMenu.OnMenuButtonClicked(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Callback event for opening instant placement menu. | ||
| /// </summary> | ||
| private void OnClickInstantPlacementMenu() | ||
| { | ||
| _settingMenuUi.SetActive(false); | ||
| _instantPlacementMenuUi.SetActive(true); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!114 &11400000 | ||
| MonoBehaviour: | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_GameObject: {fileID: 0} | ||
| m_Enabled: 1 | ||
| m_EditorHideFlags: 0 | ||
| m_Script: {fileID: 11500000, guid: 53ac32fab2599402fb6d154adf4c1e40, type: 3} | ||
| m_Name: PersistentCloudAnchorsSessionConfig | ||
| m_EditorClassIdentifier: | ||
| MatchCameraFramerate: 1 | ||
| PlaneFindingMode: 1 | ||
| LightEstimationMode: 3 | ||
| CloudAnchorMode: 1 | ||
| AugmentedImageDatabase: {fileID: 0} | ||
| CameraFocusMode: 0 | ||
| AugmentedFaceMode: 0 | ||
| DepthMode: 0 | ||
| InstantPlacementMode: 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!21 &2100000 | ||
| Material: | ||
| serializedVersion: 6 | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_Name: CircleLineMaterial | ||
| m_Shader: {fileID: 203, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_ShaderKeywords: | ||
| m_LightmapFlags: 4 | ||
| m_EnableInstancingVariants: 0 | ||
| m_DoubleSidedGI: 0 | ||
| m_CustomRenderQueue: -1 | ||
| stringTagMap: {} | ||
| disabledShaderPasses: [] | ||
| m_SavedProperties: | ||
| serializedVersion: 3 | ||
| m_TexEnvs: | ||
| - _BumpMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _DetailAlbedoMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _DetailMask: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _DetailNormalMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _EmissionMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _MainTex: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _MetallicGlossMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _OcclusionMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| - _ParallaxMap: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| m_Floats: | ||
| - _BumpScale: 1 | ||
| - _Cutoff: 0.5 | ||
| - _DetailNormalMapScale: 1 | ||
| - _DstBlend: 0 | ||
| - _GlossMapScale: 1 | ||
| - _Glossiness: 0.5 | ||
| - _GlossyReflections: 1 | ||
| - _InvFade: 1 | ||
| - _Metallic: 0 | ||
| - _Mode: 0 | ||
| - _OcclusionStrength: 1 | ||
| - _Parallax: 0.02 | ||
| - _SmoothnessTextureChannel: 0 | ||
| - _SpecularHighlights: 1 | ||
| - _SrcBlend: 1 | ||
| - _UVSec: 0 | ||
| - _ZWrite: 1 | ||
| m_Colors: | ||
| - _Color: {r: 1, g: 1, b: 1, a: 1} | ||
| - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} | ||
| - _TintColor: {r: 1, g: 1, b: 1, a: 1} |