I’m trying to set up an Object (Metro) that can pick up another Object (Player). Right now on collision the player.transform.position is equalled to the metro position. Essentially picking the player up. However there is a quirk. The player.transform.position is not what it should be on initialization, the player is put in a position in the scene it’s not supposed to be in. Not what I set it up to be in the editor. Can anyone help me fix that?
public class Metro : MonoBehaviour
{
[SerializeField] GameObject Player;
[SerializeField] GameObject MetroObject;
private bool Collided;
private bool board = false;
void Update()
{
if (Collided == true)
{
Debug.Log("Metro ride conditions met");
Player.transform.position = MetroObject.transform.position;
}
}
public void OnTriggerEnter2D(Collider2D collider)
{
if (collider.gameObject.tag == "Player")
{
Collided = true;
Debug.Log("Collided");
}
}
}
Can you help me figure this one out?