/** * <summary>Sets the value of its linked variable to its value (if appropriate).</summary> * <param name = "_location">The variable's location</param> * <param name = "_variables">The variable's Variables component, if location = VariableLocation.Component</param> */ public void Upload(VariableLocation _location = VariableLocation.Global, Variables _variables = null) { if (_location == VariableLocation.Local) { return; } if (link == VarLink.PlaymakerVariable && !string.IsNullOrEmpty(pmVar)) { if (!PlayMakerIntegration.IsDefinePresent()) { return; } if (_location != VariableLocation.Component) { _variables = null; } if (_location == VariableLocation.Component && _variables == null) { return; } switch (type) { case VariableType.Integer: case VariableType.PopUp: PlayMakerIntegration.SetInt(pmVar, val, _variables); break; case VariableType.Boolean: PlayMakerIntegration.SetBool(pmVar, (val == 1), _variables); break; case VariableType.String: PlayMakerIntegration.SetString(pmVar, textVal, _variables); break; case VariableType.Float: PlayMakerIntegration.SetFloat(pmVar, floatVal, _variables); break; case VariableType.Vector3: PlayMakerIntegration.SetVector3(pmVar, vector3Val, _variables); break; } } else if (link == VarLink.OptionsData) { Options.SavePrefs(); } else if (link == VarLink.CustomScript) { KickStarter.eventManager.Call_OnUploadVariable(this, _variables); } }