playMaker

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

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Check if String is a Valid Hex Code (for Color Variables)
« on: November 05, 2018, 01:53:58 AM »
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.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Check if String is a Valid Hex Code (for Color Variables)
« Reply #1 on: November 05, 2018, 08: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.
Available for Playmaker work