DeleteKey









How do I use Delete Key
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PhotonHandler.cs Copy
199     {
200         get
201         {
202             string prefsRegionCode = PlayerPrefs.GetString(PlayerPrefsKey, "");
203             if (!string.IsNullOrEmpty(prefsRegionCode))
204             {
205                 CloudRegionCode loadedRegion = Region.Parse(prefsRegionCode);
206                 return loadedRegion;
207             }
208
209             return CloudRegionCode.none;
210         }
211         set
212         {
213             if (value == CloudRegionCode.none)
214             {
215                 PlayerPrefs.DeleteKey(PlayerPrefsKey);
216             }
217             else
218             {
219                 PlayerPrefs.SetString(PlayerPrefsKey, value.ToString());
220             }
221         }
222     }
File name: GameManager.cs Copy
341  public static void ResetScores() {
342   PlayerPrefs.DeleteKey(PLAYER_WHITE);
343   PlayerPrefs.DeleteKey(PLAYER_BLACK);
344   PlayerPrefs.DeleteKey(GAME_CURRENT);
345  }

DeleteKey 166 lượt xem

Gõ tìm kiếm nhanh...