playMaker

Author Topic: Check if String is a Valid Hex Code (for Color Variables)  (Read 334 times)

westingtyler

  • Full Member
  • ***
  • Posts: 221
    • View Profile
    • My Oculus Rift + Touch VR Game Using Playmaker
Check if String is a Valid Hex Code (for Color Variables)
« on: November 04, 2018, 11:53:58 PM »
players can type a string, then the game sets the ambient color value to that. But what if they type a string that is too long, or isn't a valid color, or has weird symbols? i need an action that checks the string, then says yes or no, so I can send an event that provides a case to deal with that.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Re: Check if String is a Valid Hex Code (for Color Variables)
« Reply #1 on: November 05, 2018, 06:36:16 AM »
Simplest way is to call TryParseHexString method: https://docs.unity3d.com/510/Documentation/ScriptReference/Color.TryParseHexString.html

No actions for this as far as i know.