File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Internal/PlatformHooks/Unity Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,18 @@ internal static bool IsIOS {
147147 }
148148 }
149149
150+ /// <summary>
151+ /// Returns true if the current platform is tvOS.
152+ /// </summary>
153+ internal static bool IsTvOS {
154+ get {
155+ if ( settingsPath == null ) {
156+ throw new InvalidOperationException ( "Parse must be initialized before making any calls." ) ;
157+ }
158+ return Application . platform == RuntimePlatform . tvOS ;
159+ }
160+ }
161+
150162 /// <summary>
151163 /// Returns true if current running platform is Windows Phone 8.
152164 /// </summary>
@@ -230,6 +242,9 @@ private string Load() {
230242 try {
231243 if ( IsWebPlayer ) {
232244 return PlayerPrefs . GetString ( "Parse.settings" , null ) ;
245+ } else if ( IsTvOS ) {
246+ Debug . Log ( "Running on TvOS, prefs cannot be loaded." ) ;
247+ return null ;
233248 } else {
234249 using ( var fs = new FileStream ( settingsPath , FileMode . Open , FileAccess . Read ) ) {
235250 var reader = new StreamReader ( fs ) ;
@@ -250,6 +265,8 @@ private void Save() {
250265 if ( IsWebPlayer ) {
251266 PlayerPrefs . SetString ( "Parse.settings" , ParseClient . SerializeJsonString ( data ) ) ;
252267 PlayerPrefs . Save ( ) ;
268+ } else if ( IsTvOS ) {
269+ Debug . Log ( "Running on TvOS, prefs cannot be saved." ) ;
253270 } else {
254271 using ( var fs = new FileStream ( settingsPath , FileMode . Create , FileAccess . Write ) ) {
255272 using ( var writer = new StreamWriter ( fs ) ) {
You can’t perform that action at this time.
0 commit comments