Graphics.DrawTexture() in GUI.BeginScrollView() Problem

public class Foo : MonoBehaviour 
{	
	public Texture Tex;
	
	Vector2 vScroll = Vector2.zero;
	
	// Update is called once per frame
	void OnGUI () 
	{			
		Rect rcWindowArea = new Rect( 100, 100, 200, 300 );
		Rect rcContentsArea = new Rect( 100, 100, 200, 900 );
		
		GUI.Box(rcWindowArea, "window");
		
		vScroll = GUI.BeginScrollView( rcWindowArea, vScroll, rcContentsArea, false, false );		 									
		
		for ( int i=0; i<10; i++ )
		{	
			Graphics.DrawTexture( new Rect(100, 100 + i*90, 50, 50), Tex, new Rect(0, 0, 0.5f, 0.5f), 0,0,0,0);			
		}		
			           				
		GUI.EndScrollView();			
		
		
	}
}

can i clipping( crop ) Graphics.DrawTexture() Image
in out of window ???

502110--17772--$스크린샷 2011-02-17 오후 6.11.08.png

Use GUI.DrawTexture instead.

I’ve never used Graphics.DrawTexture, but I guess it hasn’t the same behaviour as GUI.DrawTexture when surrounded by GUI.BeginScrollView and GUI.EndScrollView.

thanks numid GUI.DrawTexture is work

but unfortunately GUI.DrawTexture can not support UV Texture

What are you trying to do with the UV’s, animate your cloud texture?

Right, but Graphics is not part of GUI and thus will neither respect it nor work hand in hands with it.
UV texturing is not possible with the GUI classes in any form, but you can part fake it by usage of the area / group functions to limit the area thats drawn, then though you would potentially prefer using GUI.Label with the texture to position it.

my purpose is use PackImage (many image in one file)

In that case the usage of the area / group functions can work as replacement to clip what you draw.

If thats not an option then you will have to drop using gui altogether and use something like SM2 / EZGUI or another solution that works with real meshes, unity gui has no support for uv mapped.

also it makes no sense with unity gui in case your target is to reduce drawcalls and alike by creating a tileset, because you don’t get any drawcall reductions, every single GUI.xxxx command yields in an own drawcall even if you draw the same texture 20 times in a loop. (each of them internally results in an own Graphics.DrawMesh call like graphics.drawtexture does too)

Hi Anyone found an solution to fix this issue?