Vector3 value is 0,0,0 instead of actual value

Platformtracker.cs

void Update()
    {
        if ((transform.position.x < platformTrackerPoint.transform.position.x) && thePlayerMovement.grounded)
        {
            platformTransform = gameObject.transform.position;
        }
    }

Gamemanager.cs

public void RespawnPlayer()
{ 
thePlayer.transform.position = thePlatformTracker.platformTransform;
}

Any help is much appreciated

Welcome to the world of “debugging” ^^. Have you already checked if you ever enter that if-statement inside your Update method?

void Update()
{
    if ((transform.position.x < platformTrackerPoint.transform.position.x) && thePlayerMovement.grounded)
    {
        platformTransform = transform.position;
        Debug.Log("Saved respawn position");
    }
}

When you don’t see the message “Saved respawn position” in the console, you never get into that if statement, so you never assign any value to “platformTransform” and it will stay at the defaul value which is (0, 0, 0). Rethink about your condition and if you’re not sure why the statement is never true, test each part seperately:

if (transform.position.x < platformTrackerPoint.transform.position.x)
{
    Debug.Log("x-position smaller than tracker point");
}
if (thePlayerMovement.grounded)
{
    Debug.Log("player is grounded");
}

Also make sure you don’t get any errors like a NullReferenceException which would break everything. Make sure all your references are setup properly. In your case you have 3 variables that should be checked:

  • “platformTrackerPoint”
  • “thePlayerMovement”
  • “thePlatformTracker”