Last active
June 15, 2022 12:58
-
-
Save Microsofttechies/6958fa2f5f62bb4b1eb6 to your computer and use it in GitHub Desktop.
c# dictionary add if not exist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (variables == null) | |
| { | |
| variables = new Dictionary<string, object>(); | |
| } | |
| if(variables.ContainsKey(name)) | |
| { | |
| variables[name] = value; | |
| } | |
| else | |
| { | |
| Debug.LogError("Added new Data to Global Data"+value); | |
| variables.Add(name,value); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment