Skip to content

Commit

Permalink
Rely on Google's prefab instead of duplicating it
Browse files Browse the repository at this point in the history
Kudos to Romain for a code review and pointing out my oddity
  • Loading branch information
JScott committed Mar 10, 2016
1 parent 61af319 commit 0e6db50
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 86 deletions.
4 changes: 4 additions & 0 deletions CardboardControl/DemoScenes/ControlsDemo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ Prefab:
propertyPath: layerMask.m_Bits
value: 256
objectReference: {fileID: 0}
- target: {fileID: 11447888, guid: 652814e1e9ffe134aa9b9c61f31fb762, type: 2}
propertyPath: prefab
value:
objectReference: {fileID: 171526, guid: 60270cf52a5e94998a5a335989159738, type: 2}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 652814e1e9ffe134aa9b9c61f31fb762, type: 2}
m_IsPrefabParent: 0
Expand Down
8 changes: 8 additions & 0 deletions CardboardControl/DemoScenes/WalkingDemo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ Prefab:
propertyPath: layerMask.m_Bits
value: 256
objectReference: {fileID: 0}
- target: {fileID: 11447888, guid: 652814e1e9ffe134aa9b9c61f31fb762, type: 2}
propertyPath: reticle
value:
objectReference: {fileID: 171526, guid: 60270cf52a5e94998a5a335989159738, type: 2}
- target: {fileID: 11447888, guid: 652814e1e9ffe134aa9b9c61f31fb762, type: 2}
propertyPath: prefab
value:
objectReference: {fileID: 171526, guid: 60270cf52a5e94998a5a335989159738, type: 2}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 652814e1e9ffe134aa9b9c61f31fb762, type: 2}
m_IsPrefabParent: 0
Expand Down
15 changes: 11 additions & 4 deletions CardboardControl/Prefabs/CardboardControlManager.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4e96b5b0d55c6dd48846315b5654102b, type: 3}
m_Name:
m_EditorClassIdentifier:
reticlePrefab: {fileID: 100896, guid: 4e70f128821fbd44397a839b4080d103, type: 2}
fadeTime: .600000024
fadeTime: 0.6
startHidden: 1
layerMask:
serializedVersion: 2
m_Bits: 4294967291
prefab: {fileID: 171526, guid: 60270cf52a5e94998a5a335989159738, type: 2}
--- !u!114 &11455312
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -80,7 +83,7 @@ MonoBehaviour:
gaze: {fileID: 11455312}
box: {fileID: 11481902}
reticle: {fileID: 0}
eventCooldown: .200000003
eventCooldown: 0.2
--- !u!114 &11474088
MonoBehaviour:
m_ObjectHideFlags: 1
Expand All @@ -92,7 +95,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ff5c5b6d52fa37e48991bdffd4b620e5, type: 3}
m_Name:
m_EditorClassIdentifier:
clickSpeedThreshold: .400000006
clickSpeedThreshold: 0.4
useEventCooldowns: 1
vibrateOnDown: 0
vibrateOnUp: 0
Expand Down Expand Up @@ -158,6 +161,10 @@ Prefab:
propertyPath: reticlePrefab
value:
objectReference: {fileID: 100896, guid: 4e70f128821fbd44397a839b4080d103, type: 2}
- target: {fileID: 0}
propertyPath: prefab
value:
objectReference: {fileID: 171526, guid: 60270cf52a5e94998a5a335989159738, type: 2}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 110264}
Expand Down
81 changes: 0 additions & 81 deletions CardboardControl/Prefabs/Resources/CardboardReticle.prefab

This file was deleted.

2 changes: 1 addition & 1 deletion CardboardControl/Scripts/CardboardControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void InstantiateCardboardSDKReticleObject() {
gameObject.AddComponent<GazeInputModule>();
Camera.main.gameObject.AddComponent<PhysicsRaycaster>();
// The object itself
GameObject reticlePrefab = Instantiate(Resources.Load("CardboardReticle")) as GameObject;
GameObject reticlePrefab = Instantiate(reticle.prefab) as GameObject;
reticlePrefab.transform.parent = Camera.main.transform;
reticlePrefab.transform.localPosition = Vector3.zero;
reticlePrefab.transform.localEulerAngles = Vector3.zero;
Expand Down
1 change: 1 addition & 0 deletions CardboardControl/Scripts/CardboardControlReticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class CardboardControlReticle : MonoBehaviour {
public float fadeTime = 0.6f;
public bool startHidden = true;
public LayerMask layerMask = Physics.DefaultRaycastLayers;
public GameObject prefab;

private GameObject reticle;
private ColorFade colorFade = new ColorFade();
Expand Down

0 comments on commit 0e6db50

Please sign in to comment.