How to cut a texture? (parallax inside a box)


How to cut a texture?
I wanted to make a parallax inside a square, I have a Gameobject with several sprites, the problem is that each sprite is full, and I want to show only one part, and then move it and show the remain sprite, (moving it from left to right from example), can this be done?


You can do it with stencil in ui.
For sprite - either shader or the trick with render target.


I dont know what are you talking about, can you explain more noob friendly? thanks


Simplest way - in UI, just put one node into another and setup stencil mask so you can move the inner node and see only part of it.
Or you can render sprite into custom render target and then render quad\sprite with resulted texture on main render target.


I try the ui mode, its hard to understand how render works…
Now, how can I move in runtime the node inside the first node? I will need to have one node followed by another, no? thanks

I try gui.get_node(“box1/box2”) but doesnt work


gui.set_position(node, vector3) will move a node. Check the API reference:


Ok, I thought I need to pass the parent.

and for do the same with GameObjects?


Discussed here: How to mask/clipping a sprite?