Hi everybody,
Firstly, since I’m new and this is my first action in the Unity Community, nice to meet you !
I would like to know if it exists an API call to get the pre-defined color (as we can see in the “Navigation” panel under “Areas” section) of a particular NavMesh area, giving its name or its identifier ?
Unfortunately, I have not been successful on finding it in the API documentation.
Thanks in advance for the help !
Is anybody here that knows this information ?
Is it something possible to do ?
This should do it
// UnityEditor.NavMeshEditorWindow
private Color GetAreaColor(int i)
{
Color result;
if (i == 0)
{
result = new Color(0f, 0.75f, 1f, 0.5f);
}
else
{
int num = (this.Bit(i, 4) + this.Bit(i, 1) * 2 + 1) * 63;
int num2 = (this.Bit(i, 3) + this.Bit(i, 2) * 2 + 1) * 63;
int num3 = (this.Bit(i, 5) + this.Bit(i, 0) * 2 + 1) * 63;
result = new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, 0.5f);
}
return result;
}