ソースコード
using UnityEngine;
public static class Color32Ext
{
public static void Deconstruct
(
this Color32 self,
out byte r,
out byte g,
out byte b
)
{
r = self.r;
g = self.g;
b = self.b;
}
public static void Deconstruct
(
this Color32 self,
out byte r,
out byte g,
out byte b,
out byte a
)
{
r = self.r;
g = self.g;
b = self.b;
a = self.a;
}
}
使用例
通常
var col = new Color32( 255, 192, 128, 64 );
Deconstruction
var ( r, g, b ) = new Color32( 255, 192, 128, 64 );
var ( r, g, b, a ) = new Color32( 255, 192, 128, 64 );