I’ve been trying to have my player moved to a specific location in a new scene once it’s loaded, but, although there are no errors showing, the new scene loads but the player is not in the new location.
Please let me know if you can see why this is not working. If I comment out the scene transfer, the position move works fine. But when I put it back in, the scene change works but it seems to ignore the position change.
Please help!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class BedroomDoor : MonoBehaviour
{
void OnCollisionEnter2D(Collision2D other)
{
LandonController player = other.gameObject.GetComponent();
if (player != null)
{
SceneManager.LoadScene(“Kitchen”);
}
void MovePlayer() {
Vector2 position = transform.position;
transform.localPosition = new Vector2(37, -16);
transform.localPosition = position;
}
MovePlayer();
}
}