/// <summary>
        /// Modifies a World Variable by name. You can set, add, multiply or subtract the value.
        /// </summary>
        /// <param name='modifier'>Modifier.</param>
        /// <param name='sourceTrans'>Source trans. Optional - this will output in the debug message if the World Variable is not found.</param>
        public static void ModifyPlayerStat(WorldVariableModifier modifier, Transform sourceTrans = null)
        {
            var statName = modifier._statName;

            if (!InGamePlayerStats.ContainsKey(statName))
            {
                LevelSettings.LogIfNew(
                    string.Format(
                        "Transform '{0}' tried to modify a World Variable called '{1}', which was not found in this scene.",
                        sourceTrans == null ? LevelSettings.EmptyValue : sourceTrans.name,
                        statName));

                return;
            }

            var stat = InGamePlayerStats[statName];

            switch (modifier._varTypeToUse)
            {
            case VariableType._integer:
            case VariableType._float:
                stat.ModifyVariable(modifier);
                break;

            default:
                LevelSettings.LogIfNew("Write code for varType: " + modifier._varTypeToUse.ToString());
                break;
            }
        }
 /// <summary>
 /// This returns an instance of the WorldVariable at runtime.
 /// </summary>
 /// <param name="statName">The World Variable name.</param>
 /// <returns>InGameWorldVariable object</returns>
 public static InGameWorldVariable GetWorldVariable(string statName)
 {
     if (InGamePlayerStats.ContainsKey(statName))
     {
         return(InGamePlayerStats[statName]);
     }
     if (statName == LevelSettings.DropDownNoneOption)
     {
         // don't log here.
     }
     else
     {
         LevelSettings.LogIfNew("Could not find World Variable '" + statName + "'.");
     }
     return(null);
 }
 /// <summary>
 /// Check at runtime whether the World Variable exists in this Scene.
 /// </summary>
 /// <param name="statName">World Variable name</param>
 /// <returns>boolean</returns>
 public static bool VariableExistsInScene(string statName)
 {
     return(InGamePlayerStats.ContainsKey(statName));
 }