Is possible to cast Rect values to a vector4 ?
Im using PackTextures , which is returning Rect but is complaining when i try to cast it
_uvs = (Vector4)_packedTexture.PackTextures(textures, 0, _textureResolution);
Is possible to cast Rect values to a vector4 ?
Im using PackTextures , which is returning Rect but is complaining when i try to cast it
_uvs = (Vector4)_packedTexture.PackTextures(textures, 0, _textureResolution);
There is no implicit way to cast a Rect to a Vector4.
Store the Rect in a temporary variable, and construct a new Vector4.
Thanks!!
The issue, I assume, is there are 2 ways to define a Unity Rect. One is xLow, xHigh, yLow, yHigh; the other is xLow, yLow, width, height. You can use both on the same Rect. A cast couldn’t know which one you wanted.
Vector4[ ] rectVectors = new Vector4[rect.Length];
for (int i = 0; i < rect.Length; i++)
{
rectVectors = new Vector4(rect.x, rect.y, rect_.width, rect*.height);
}*_
Please try to not necropost. Also, FYI, here’s how to post code on the forums: Using code tags properly
Thanks.