Skip to main content
added 301 characters in body
Source Link

Currently, I am scrolling a UI RawImage using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I needI'd like to use a regular Image, rather than RawImage. The reason I'd like to switch to using a regular Image is because I need to tile an image to fill the dialogue box below:

enter image description here

From what I can tell, RawImage doesn't seem to allow for tiling the way Image does. Is there a similar and simple way to accomplish this scrolling effect with Image?

Currently, I am scrolling a UI RawImage using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I need to use a regular Image, rather than RawImage. Is there a similar and simple way to accomplish this scrolling effect with Image?

Currently, I am scrolling a UI RawImage using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I'd like to use a regular Image, rather than RawImage. The reason I'd like to switch to using a regular Image is because I need to tile an image to fill the dialogue box below:

enter image description here

From what I can tell, RawImage doesn't seem to allow for tiling the way Image does. Is there a similar and simple way to accomplish this scrolling effect with Image?

added markdown to code in text, removed fluff text
Source Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

Currently, I am scrolling a UI "RawImage"RawImage using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I need to use a regular "Image"Image, rather than "RawImage"RawImage. Is there a similar and simple way to accomplish this scrolling effect with ImageImage? Thanks!

Currently, I am scrolling a UI "RawImage" using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I need to use a regular "Image", rather than "RawImage". Is there a similar and simple way to accomplish this scrolling effect with Image? Thanks!

Currently, I am scrolling a UI RawImage using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I need to use a regular Image, rather than RawImage. Is there a similar and simple way to accomplish this scrolling effect with Image?

Source Link

Scroll UI Image

Currently, I am scrolling a UI "RawImage" using the following:

[SerializeField] private RawImage _imageToScroll;
[SerializeField] private float _x, _y;
// Update is called once per frame
void Update()
{
    _imageToScroll.uvRect = new Rect(_imageToScroll.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _imageToScroll.uvRect.size);
}

However, I need to use a regular "Image", rather than "RawImage". Is there a similar and simple way to accomplish this scrolling effect with Image? Thanks!