/// <summary> /// Update a property of the Text Componenent. /// </summary> /// <param name="targetElement">The element to update</param> /// <param name="uivalue">The new value</param> public void UpdateTextComponent(PropertyBinding targetElement, object uivalue) { Text textComponent = targetElement.GetComponent <Text>(); switch (targetElement.Field.ToLower()) { case "text": try { if (string.IsNullOrEmpty(uivalue.ToString())) { Debug.LogError("Warning! String is null or empty"); } textComponent.text = replaceBoundStringElement(textComponent.text, uivalue.ToString()); } catch (Exception e) { Debug.LogError(e.ToString()); } break; case "color": try { textComponent.color = (Color)uivalue; } catch (Exception e) { Debug.LogError(e.ToString()); } break; case "fontsize": try { textComponent.fontSize = (int)uivalue; } catch (Exception e) { Debug.LogError(e.ToString()); } break; case "fontstyle": try { if ((int)uivalue > 3) { Debug.LogError("Font style does not exist! Set with the (FontStyle) enum instead of (int)."); } textComponent.fontStyle = (FontStyle)uivalue; } catch (Exception e) { Debug.LogError(e.ToString()); } break; default: break; } }