playMaker

Author Topic: Any idea how to use 'Convert String to Color' action?  (Read 805 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Any idea how to use 'Convert String to Color' action?
« on: September 21, 2018, 01:58:51 PM »
https://github.com/jeanfabre/PlayMakerCustomActions_U4/blob/master/Assets/PlayMaker%20Custom%20Actions/Convert/ConvertStringToColor.cs

The format is:

Code: [Select]
Color\([r],[g],[b],[a]\)

What are the backslashes for?
I looked at the code and there are even those \\, about which all I found is this: https://regexone.com/references/csharp

Also I don't understand why we have to indicate a value for the alpha ([a]) since in the code, there's the following line:

Code: [Select]
Color32 _col = new Color32(byte.Parse(m.Groups["r"].Value),byte.Parse(m.Groups["g"].Value),byte.Parse(m.Groups["b"].Value),255);
..which implies, if I'm correct, that the alpha value will be ignored anyway and considered at full opacity.

I tried several formats and also wrote the parsed string in many different ways but it didn't work.
So how is this action meant to be used exactly?