Offset texture on an object

Hi!
On https://constrvct.com/designs/new has an interesting feature: when you move the mouse texture in the central large square is shifted textures on 3D objects.
How is it possible to implement in Unity?
Does anyone have a ready script?

This can be done using Material.SetTextureOffset(). Below is a example script. Create and object and a Quad. Put the same material on both. Attach this script to the Quad. Drag and drop the other object to the ‘object’ variable in the script attached to the quad.

#pragma strict

var object : GameObject;
var factor = 0.01;

private var startPos : Vector2;
private var startOffset : Vector2;

function Start() {
                    // Could be done in the editor
	renderer.material.SetTextureScale("_MainTex", Vector2(0.2, 0.2)); 
}

function OnMouseDown() {
	startPos = Input.mousePosition;
	startOffset = renderer.material.GetTextureOffset("_MainTex");
}

function OnMouseDrag() {
	var v = (Input.mousePosition - startPos) * factor;
	renderer.material.SetTextureOffset("_MainTex", startOffset - v);
	object.renderer.material.SetTextureOffset("_MainTex", startOffset - v);
}

There is one problem with this code I did add the code to solve. This code uses mouse coordinates to calculate the amount of movement of the texture offset, so it is not platform independent. You’ll need additional work if you are targeting multiple platforms.