Separate Numbers ?

Hello :slight_smile:
I have the code where is i have two variables : thresX and thresY.

They are going back and forth and have the same number. So what I want to do is that to make them not having the exact number like -1 and -1.

**But I want to make them have like -1 and another 1.

Here is the code, maybe i need to change time or something like that?**

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScoreTextOffset : MonoBehaviour {

	public Material mainMat;

	public float thresX;
	public float thresY;

	static float t;

	public float max;
	public float min;

	void Start () {
		thresX = mainMat.GetFloat ("_UnderlayOffsetX");
		thresY = mainMat.GetFloat ("_UnderlayOffsetY");
	}

	void Update () {
		t = Time.time;
		thresX = min + Mathf.PingPong(t,max);
		thresY = min + Mathf.PingPong(t,max);

		mainMat.SetFloat ("_UnderlayOffsetX", thresX);
		mainMat.SetFloat ("_UnderlayOffsetY", thresY);
	}
}

Replace these lines of code:

         thresX = min + Mathf.PingPong(t,max);
         thresY = min + Mathf.PingPong(t,max);

with these:

thresX = min + Mathf.PingPong(t, max);
thresY = min + Mathf.PingPong(t, max);
thresY *= -1;