Skip to content

Instantly share code, notes, and snippets.

@Microsofttechies
Last active June 15, 2022 12:58
Show Gist options
  • Select an option

  • Save Microsofttechies/6958fa2f5f62bb4b1eb6 to your computer and use it in GitHub Desktop.

Select an option

Save Microsofttechies/6958fa2f5f62bb4b1eb6 to your computer and use it in GitHub Desktop.
c# dictionary add if not exist
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