From dfd3b76fbf079f859c58b7e86cc1ce4ce8cbd219 Mon Sep 17 00:00:00 2001 From: Tim Gerken Date: Fri, 11 May 2018 11:23:58 +0100 Subject: [PATCH] Addresses #MRTK-Unity:2068: private fields being assinged but not used - wrapped some in #if Unity_IOS - removed one altogether - disabled compiler warning via pragma for [SyncVar] and [SerializeField] Some minor whitespace cleanup that should have happend in original PR --- .../Scripts/Recording/ReplayKitRecorder.cs | 65 ++++++++++--------- .../Scripts/SpatialSync/WorldSync.cs | 2 + 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/Assets/HoloToolkit/SpectatorView/Scripts/Recording/ReplayKitRecorder.cs b/Assets/HoloToolkit/SpectatorView/Scripts/Recording/ReplayKitRecorder.cs index 852ece0b065..c3639b92fc2 100644 --- a/Assets/HoloToolkit/SpectatorView/Scripts/Recording/ReplayKitRecorder.cs +++ b/Assets/HoloToolkit/SpectatorView/Scripts/Recording/ReplayKitRecorder.cs @@ -19,63 +19,64 @@ public class ReplayKitRecorder : MonoBehaviour /// /// Controls container gameObject /// - [Tooltip("Controls container gameObject")] + [Tooltip("Controls container gameObject")] [SerializeField] private GameObject controls; +#pragma warning disable 0414 /// /// Seconds to countdown before recording /// - [Tooltip("Seconds to countdown before recording")] + [Tooltip("Seconds to countdown before recording")] [SerializeField] private int countDownNumber = 3; +#pragma warning restore 0414 - /// - /// If an error ocurred, this variable will hold the last error message - /// - private string lastError = ""; - +#if UNITY_IOS /// /// Is the component preparing for recording (Counting down) /// private bool preparingForRecording; +#endif /// /// Record button gameObject /// - [Tooltip("Record button gameObject")] + [Tooltip("Record button gameObject")] public GameObject RecordButton; /// /// Recording countdown button gameObject /// - [Tooltip("Recording countdown button gameObject")] + [Tooltip("Recording countdown button gameObject")] [SerializeField] private GameObject recordCountdownButton; /// /// Record countdown textfield /// - [Tooltip("Record countdown textfield")] + [Tooltip("Record countdown textfield")] [SerializeField] private Text recordCountdownText; +#if UNITY_IOS /// /// Used to check whether the component is recording or not /// private bool recording = false; +#endif /// /// Replay (preview) button gameObject /// - [Tooltip("Replay (preview) button gameObject")] + [Tooltip("Replay (preview) button gameObject")] [SerializeField] private GameObject replayButton; /// /// Stop button gameObject /// - [Tooltip("Stop button gameObject")] + [Tooltip("Stop button gameObject")] [SerializeField] private GameObject stopButton; @@ -84,8 +85,8 @@ public class ReplayKitRecorder : MonoBehaviour /// public GameObject Controls { - get {return Controls;} - set {Controls = value;} + get { return Controls; } + set { Controls = value; } } /// @@ -93,8 +94,8 @@ public GameObject Controls /// public GameObject RecordCountdownButton { - get {return recordCountdownButton;} - set {recordCountdownButton = value;} + get { return recordCountdownButton; } + set { recordCountdownButton = value; } } /// @@ -102,8 +103,8 @@ public GameObject RecordCountdownButton /// public Text RecordCountdownText { - get {return recordCountdownText;} - set {recordCountdownText = value;} + get { return recordCountdownText; } + set { recordCountdownText = value; } } /// @@ -111,8 +112,8 @@ public Text RecordCountdownText /// public GameObject ReplayButton { - get {return replayButton;} - set {replayButton = value;} + get { return replayButton; } + set { replayButton = value; } } /// @@ -120,8 +121,8 @@ public GameObject ReplayButton /// public GameObject StopButton { - get {return stopButton;} - set {stopButton = value;} + get { return stopButton; } + set { stopButton = value; } } private void Start() @@ -134,7 +135,7 @@ private void Update() #if UNITY_IOS recording = ReplayKit.isRecording; - if(recording) + if (recording) { StopButton.SetActive(true); RecordButton.SetActive(false); @@ -145,7 +146,7 @@ private void Update() } // Check if theres any available recorded video - if(ReplayKit.recordingAvailable) + if (ReplayKit.recordingAvailable) { ReplayButton.SetActive(true); } @@ -154,14 +155,14 @@ private void Update() ReplayButton.SetActive(false); } - if(preparingForRecording) + if (preparingForRecording) { RecordCountdownButton.SetActive(true); } else { RecordCountdownButton.SetActive(false); - if(!recording) + if (!recording) { RecordButton.SetActive(true); } @@ -175,7 +176,7 @@ private void Update() public void PrepareForRecording() { #if UNITY_IOS - if(!ReplayKit.APIAvailable) + if (!ReplayKit.APIAvailable) { return; } @@ -195,6 +196,7 @@ public void PrepareForRecording() /// public void Countdown() { +#if UNITY_IOS RecordCountdownText.text = countDownNumber.ToString(); if (countDownNumber != 0) { @@ -208,6 +210,9 @@ public void Countdown() preparingForRecording = false; StartRecording(); } +#else + Debug.LogWarning("Not implemented on the current platform"); +#endif } /// @@ -216,12 +221,12 @@ public void Countdown() public void StartRecording() { #if UNITY_IOS - if(!ReplayKit.APIAvailable) + if (!ReplayKit.APIAvailable) { return; } - if(!recording) + if (!recording) { ReplayKit.StartRecording(true, true); Controls.SetActive(false); @@ -237,7 +242,7 @@ public void StartRecording() public void StopRecording() { #if UNITY_IOS - if(recording) + if (recording) { ReplayKit.StopRecording(); RecordButton.SetActive(true); diff --git a/Assets/HoloToolkit/SpectatorView/Scripts/SpatialSync/WorldSync.cs b/Assets/HoloToolkit/SpectatorView/Scripts/SpatialSync/WorldSync.cs index e2b34cce936..15a2227b05d 100644 --- a/Assets/HoloToolkit/SpectatorView/Scripts/SpatialSync/WorldSync.cs +++ b/Assets/HoloToolkit/SpectatorView/Scripts/SpatialSync/WorldSync.cs @@ -79,12 +79,14 @@ public class WorldSync : NetworkBehaviour /// public OnWorldSyncCompleteEvent OnWorldSyncCompleteClient; +#pragma warning disable 0414 /// /// String used to sync transform information /// stored in the format: xPos:yPos:zPos:yRot /// [SyncVar(hook = "AdjustOrientation")] private string syncedTransformString; +#pragma warning restore 0414 /// /// Position of the marker in World-Space