Hi guys,
I was just wondering if there is a way of assigning the result of a generated texture that is stored in a Texture2D type variable to a GUITexture.texture to have it actually display on screen.
Directly assigning it as this:
01 mapTexture = menuObj.GetComponent( GUITexture );
02 mapTexture.texture.SetPixels(structureGen.mapTexture.GetPixels());
03 mapTexture.texture.Apply();
where structureGen.mapTexture is the stored image in a Texture2D format, works in Editor.
It does not Build though (the project is set to iOS), because of the following errors:
the errors on these three lines of code when turning on #pragma strict
01 Cannot convert ‘UnityEngine.Component’ to ‘UnityEngine.GUITexture’.
02 ‘SetPixels’ is not a member of ‘UnityEngine.Texture’.
03 ‘Apply’ is not a member of ‘UnityEngine.Texture’.
I understand this as of course, mapTexture.texture is not a Texture2D to which those methods apply.
My question is, how would you guys assign the texture2D content to a GUITexture.texture
Thank you in advance for any answers.
Bye the way, Happy Holidays to all! (i do not wish to break a chain of programming nights ![]()