Update function ruining my lerp code and i cant figure out way to get around it.

I don’t know how to stop update forcing my function to reset ‘t’ to ‘timetolerp’.

I understand the problem, what’s happening is the update function is calling my function(which is called within the unity lerp function in weather.cs to define t) and my t value in my function(Time.cs) is constantly reset because i’m declaring what t is then i’m subtracting it, but before it can get any smaller it is reset because the update function calls my function again and it has to.

I don’t know how to get around this because t in my function needs to be defined;

Time.cs

using UnityEngine;

public class Time
{
    public static float LerpTFunction(float timeToLerp)
    {
        float t = timeToLerp;
        t -= UnityEngine.Time.deltaTime;

        Debug.Log(t);
        return t;
    }
}

Weather.cs

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

public class Weather : MonoBehaviour
{
    public float Position;

    public float Ttolerp;

    public float PointA;
    public float PointB;

    void Update()
    {
        Position = Mathf.Lerp(PointA, PointB, Time.LerpTFunction(Ttolerp));
    }
}

before it can get any smaller it is
reset because the update function
calls my function again

Not really. Update() is synchronously called once per frame, so your code will finish each time before Unity has a chance to call it again.

You simply never change your variable Ttolerp anywhere. Or any other variable that stores the previous t value. If you need Ttolerp to keep the initial value, you have to add another member variable and assign the return value from your LerpTFunction() to it on each Update().

 void Update()
 {
     if (Ttolerp > 0) {
        Ttolerp = Mathf.Max(0, Time.LerpTFunction(Ttolerp));
        Position = Mathf.Lerp(PointA, PointB, Ttolerp);
     }
 }

void Update()
{
Ttolerp -= Time.deltaTime;
Position = Mathf.Lerp(PointA, PointB, Ttolerp);
}

It is strange that you are lerping inverse, but this should work.