Jump to content

Hey I need help with a Problem... I want to thread the conversion from a byte array to a texture. As I am informed I cant do that directly but speed up the process by converting from byte[] to color[] The Question I have is: how do I convert the two Arrays?

 

Thanks in advance

Link to comment
https://linustechtips.com/topic/975483-converting-byte-to-color/
Share on other sites

Link to post
Share on other sites

Byte is a Single number. 

Color is a structure of RGBA. 

 

Youd need 4~ bytes for every color. 

 

What I’d do is some kind of for loop with division to say “first 4 numbers are for color 1. Second 4 are for color two” and so on. 

 

 

EDIT
Here is the Unity Documentation on Color:

https://docs.unity3d.com/ScriptReference/Color.html

 

EDIT EDIT
Microsoft's documentation on the Byte variable type:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/byte

 

Microsoft created C#. A Byte in C#

Quote

It is the smallest number variable you can use. Values range from 0-255 or 

Quote

.NET Framework also includes a signed 8-bit integer value type, SByte, which represents values that range from -128 to 127.

https://docs.microsoft.com/en-us/dotnet/api/system.byte?view=netframework-4.7.2

I hope that helps. 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×