I’m very new in unity and still learning. I have a dome with a 360° texture in it, I need to be able to move the offset of the texture with the finger, so I can see the rest of the 360° texture.
This is what I have so far. Don’t know why isn’t working…
public class offset : MonoBehaviour
{
private Touch touch;
private float speedModifier;
// Start is called before the first frame update
void Start()
{
speedModifier = 0.01f;
}
// Update is called once per frame
void Update()
{
if (Input.touchCount > 0)
{
touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved)
{
float OffsetX = Time.time * speedModifier;
GetComponent<Renderer>().material.mainTextureOffset = new Vector2(OffsetX, OffsetX);
}
}
}
}