@@ -19,63 +19,64 @@ public class ReplayKitRecorder : MonoBehaviour
1919 /// <summary>
2020 /// Controls container gameObject
2121 /// </summary>
22- [ Tooltip ( "Controls container gameObject" ) ]
22+ [ Tooltip ( "Controls container gameObject" ) ]
2323 [ SerializeField ]
2424 private GameObject controls ;
2525
26+ #pragma warning disable 0414
2627 /// <summary>
2728 /// Seconds to countdown before recording
2829 /// </summary>
29- [ Tooltip ( "Seconds to countdown before recording" ) ]
30+ [ Tooltip ( "Seconds to countdown before recording" ) ]
3031 [ SerializeField ]
3132 private int countDownNumber = 3 ;
33+ #pragma warning restore 0414
3234
33- /// <summary>
34- /// If an error ocurred, this variable will hold the last error message
35- /// </summary>
36- private string lastError = "" ;
37-
35+ #if UNITY_IOS
3836 /// <summary>
3937 /// Is the component preparing for recording (Counting down)
4038 /// </summary>
4139 private bool preparingForRecording ;
40+ #endif
4241
4342 /// <summary>
4443 /// Record button gameObject
4544 /// </summary>
46- [ Tooltip ( "Record button gameObject" ) ]
45+ [ Tooltip ( "Record button gameObject" ) ]
4746 public GameObject RecordButton ;
4847
4948 /// <summary>
5049 /// Recording countdown button gameObject
5150 /// </summary>
52- [ Tooltip ( "Recording countdown button gameObject" ) ]
51+ [ Tooltip ( "Recording countdown button gameObject" ) ]
5352 [ SerializeField ]
5453 private GameObject recordCountdownButton ;
5554
5655 /// <summary>
5756 /// Record countdown textfield
5857 /// </summary>
59- [ Tooltip ( "Record countdown textfield" ) ]
58+ [ Tooltip ( "Record countdown textfield" ) ]
6059 [ SerializeField ]
6160 private Text recordCountdownText ;
6261
62+ #if UNITY_IOS
6363 /// <summary>
6464 /// Used to check whether the component is recording or not
6565 /// </summary>
6666 private bool recording = false ;
67+ #endif
6768
6869 /// <summary>
6970 /// Replay (preview) button gameObject
7071 /// </summary>
71- [ Tooltip ( "Replay (preview) button gameObject" ) ]
72+ [ Tooltip ( "Replay (preview) button gameObject" ) ]
7273 [ SerializeField ]
7374 private GameObject replayButton ;
7475
7576 /// <summary>
7677 /// Stop button gameObject
7778 /// </summary>
78- [ Tooltip ( "Stop button gameObject" ) ]
79+ [ Tooltip ( "Stop button gameObject" ) ]
7980 [ SerializeField ]
8081 private GameObject stopButton ;
8182
@@ -84,44 +85,44 @@ public class ReplayKitRecorder : MonoBehaviour
8485 /// </summary>
8586 public GameObject Controls
8687 {
87- get { return Controls ; }
88- set { Controls = value ; }
88+ get { return Controls ; }
89+ set { Controls = value ; }
8990 }
9091
9192 /// <summary>
9293 /// Recording countdown button gameObject
9394 /// </summary>
9495 public GameObject RecordCountdownButton
9596 {
96- get { return recordCountdownButton ; }
97- set { recordCountdownButton = value ; }
97+ get { return recordCountdownButton ; }
98+ set { recordCountdownButton = value ; }
9899 }
99100
100101 /// <summary>
101102 /// Record countdown textfield
102103 /// </summary>
103104 public Text RecordCountdownText
104105 {
105- get { return recordCountdownText ; }
106- set { recordCountdownText = value ; }
106+ get { return recordCountdownText ; }
107+ set { recordCountdownText = value ; }
107108 }
108109
109110 /// <summary>
110111 /// Replay (preview) button gameObject
111112 /// </summary>
112113 public GameObject ReplayButton
113114 {
114- get { return replayButton ; }
115- set { replayButton = value ; }
115+ get { return replayButton ; }
116+ set { replayButton = value ; }
116117 }
117118
118119 /// <summary>
119120 /// Stop button gameObject
120121 /// </summary>
121122 public GameObject StopButton
122123 {
123- get { return stopButton ; }
124- set { stopButton = value ; }
124+ get { return stopButton ; }
125+ set { stopButton = value ; }
125126 }
126127
127128 private void Start ( )
@@ -134,7 +135,7 @@ private void Update()
134135#if UNITY_IOS
135136 recording = ReplayKit . isRecording ;
136137
137- if ( recording )
138+ if ( recording )
138139 {
139140 StopButton . SetActive ( true ) ;
140141 RecordButton . SetActive ( false ) ;
@@ -145,7 +146,7 @@ private void Update()
145146 }
146147
147148 // Check if theres any available recorded video
148- if ( ReplayKit . recordingAvailable )
149+ if ( ReplayKit . recordingAvailable )
149150 {
150151 ReplayButton . SetActive ( true ) ;
151152 }
@@ -154,14 +155,14 @@ private void Update()
154155 ReplayButton . SetActive ( false ) ;
155156 }
156157
157- if ( preparingForRecording )
158+ if ( preparingForRecording )
158159 {
159160 RecordCountdownButton . SetActive ( true ) ;
160161 }
161162 else
162163 {
163164 RecordCountdownButton . SetActive ( false ) ;
164- if ( ! recording )
165+ if ( ! recording )
165166 {
166167 RecordButton . SetActive ( true ) ;
167168 }
@@ -175,7 +176,7 @@ private void Update()
175176 public void PrepareForRecording ( )
176177 {
177178#if UNITY_IOS
178- if ( ! ReplayKit . APIAvailable )
179+ if ( ! ReplayKit . APIAvailable )
179180 {
180181 return ;
181182 }
@@ -195,6 +196,7 @@ public void PrepareForRecording()
195196 /// </summary>
196197 public void Countdown ( )
197198 {
199+ #if UNITY_IOS
198200 RecordCountdownText . text = countDownNumber . ToString ( ) ;
199201 if ( countDownNumber != 0 )
200202 {
@@ -208,6 +210,9 @@ public void Countdown()
208210 preparingForRecording = false ;
209211 StartRecording ( ) ;
210212 }
213+ #else
214+ Debug . LogWarning ( "Not implemented on the current platform" ) ;
215+ #endif
211216 }
212217
213218 /// <summary>
@@ -216,12 +221,12 @@ public void Countdown()
216221 public void StartRecording ( )
217222 {
218223#if UNITY_IOS
219- if ( ! ReplayKit . APIAvailable )
224+ if ( ! ReplayKit . APIAvailable )
220225 {
221226 return ;
222227 }
223228
224- if ( ! recording )
229+ if ( ! recording )
225230 {
226231 ReplayKit . StartRecording ( true , true ) ;
227232 Controls . SetActive ( false ) ;
@@ -237,7 +242,7 @@ public void StartRecording()
237242 public void StopRecording ( )
238243 {
239244#if UNITY_IOS
240- if ( recording )
245+ if ( recording )
241246 {
242247 ReplayKit . StopRecording ( ) ;
243248 RecordButton . SetActive ( true ) ;
0 commit comments