Skip to content

Commit

Permalink
Adding prefab, visibility script
Browse files Browse the repository at this point in the history
  • Loading branch information
Zee2 committed Sep 30, 2022
1 parent e65d5b8 commit 730545b
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1027766260150840433
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5638131629905098188}
- component: {fileID: 6617231595093284833}
- component: {fileID: 2102423086962134640}
- component: {fileID: 8109946847869331357}
m_Layer: 0
m_Name: Cube.001
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5638131629905098188
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027766260150840433}
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067}
m_LocalPosition: {x: -0, y: 0.65676373, z: -0.7}
m_LocalScale: {x: 116.666664, y: 159.24263, z: 100}
m_Children: []
m_Father: {fileID: 8151393333055720330}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &6617231595093284833
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027766260150840433}
m_Mesh: {fileID: 4493585093827132993, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
--- !u!23 &2102423086962134640
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027766260150840433}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: cb93607d1eaac094f93cad9763b32353, type: 2}
- {fileID: 2100000, guid: cb93607d1eaac094f93cad9763b32353, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &8109946847869331357
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027766260150840433}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 4493585093827132993, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
--- !u!1 &4341625919259258056
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3720680212623092329}
m_Layer: 0
m_Name: Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3720680212623092329
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4341625919259258056}
m_LocalRotation: {x: -0.00000003774895, y: 0, z: -0, w: 1}
m_LocalPosition: {x: -0, y: 1.9007708, z: 0}
m_LocalScale: {x: 100, y: 100, z: 100}
m_Children: []
m_Father: {fileID: 8151393333055720330}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5090441940898183724
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5382708896632745925}
m_Layer: 0
m_Name: Spot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5382708896632745925
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5090441940898183724}
m_LocalRotation: {x: -0.00000003774895, y: 0, z: -0, w: 1}
m_LocalPosition: {x: -0, y: 1.9038757, z: -0.6999314}
m_LocalScale: {x: 100, y: 100, z: 100}
m_Children: []
m_Father: {fileID: 8151393333055720330}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8814742530214482224
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8151393333055720330}
m_Layer: 0
m_Name: RoomPrefab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8151393333055720330
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8814742530214482224}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3720680212623092329}
- {fileID: 5638131629905098188}
- {fileID: 5382708896632745925}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}

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

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RenderSettings:
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
Expand All @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.18028352, g: 0.22571376, b: 0.30692244, a: 1}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -2501,6 +2501,71 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1001 &389055594
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalRotation.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 180
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -1461304994638716399, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: cb93607d1eaac094f93cad9763b32353, type: 2}
- target: {fileID: -1461304994638716399, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: cb93607d1eaac094f93cad9763b32353, type: 2}
- target: {fileID: 919132149155446097, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
propertyPath: m_Name
value: room
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6b0debf97988b7445b5111a86fcb716e, type: 3}
--- !u!1001 &392741044
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -11581,7 +11646,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6593650948243348711, guid: 7148f9ce86f62ab4b8d89dc6cfa369a0, type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: -0.000000029802322
objectReference: {fileID: 0}
- target: {fileID: 6593650948243348711, guid: 7148f9ce86f62ab4b8d89dc6cfa369a0, type: 3}
propertyPath: m_LocalPosition.z
Expand Down Expand Up @@ -13445,6 +13510,10 @@ PrefabInstance:
propertyPath: m_Size.y
value: 32
objectReference: {fileID: 0}
- target: {fileID: 7554432016613770522, guid: a31291e7cd07cc34f9b29ec2a6ab7224, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: -1005824763306460071, guid: 533bdd8d5c92b52448ee2ecf7bd828a4, type: 2}
- target: {fileID: 7613463721665348061, guid: a31291e7cd07cc34f9b29ec2a6ab7224, type: 3}
propertyPath: m_LocalPosition.y
value: 0.016499994
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;

namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
/// <summary>
/// This script disables the GameObject if the first detected XRDisplaySubsystem is
/// not opaque. (If no XRDisplaySubsystem is found, the script assumes the platform's
/// display is opaque.) Useful for only showing environment models on opaque/VR devices.
/// </summary>
internal class OnlyShowWhileOpaque : MonoBehaviour
{
private XRDisplaySubsystem displaySubsystem = null;

private bool isVisible = false;

private void Awake()
{
isVisible = gameObject.activeSelf;
}

private void Update()
{
// TODO: possibly remove timeout once XRSubsystemHelpers are more efficient (#10852)
if (displaySubsystem == null && Time.time < 5.0f)
{
displaySubsystem = XRSubsystemHelpers.DisplaySubsystem;
}

// If we've successfully found a displaySubsystem, but the current visibility
// doesn't match the opacity of the XR display...
if (displaySubsystem != null && isVisible != displaySubsystem.displayOpaque)
{
isVisible = displaySubsystem.displayOpaque;
gameObject.SetActive(isVisible);
}
}
}
}

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

0 comments on commit 730545b

Please sign in to comment.