Home>

I want to change the coordinates,
You can change the coordinates at the start,
I cannot change the coordinates in Update. .

Applicable source code

NowRoomNum changes to 2 at Run time.
RoomFlg is unchecked and set to false at run time.
It passes through the switch statement firmly. (Debug confirmed)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AllManage: MonoBehaviour
{
    // R1 pos -50 3.7 28 rot Y 180
    // R2 pos 16 3.7 29 rot Y 180
    // R3 pos 28 3.7 75.8 rot Y 90
    // R4 pos -15.6 3.7 116.6 rot Y 0
    // R5 pos -61.4 3.7 77 rot Y 270
    public GameObject PlayerObj;
    public int NowRoomNum = 1;
    Vector3 worldAngle;
    public bool RoomFlg = false;
    // Start is called before the first frame update
    void Start ()
    {
        PlayerObj.transform.position = new Vector3 (-50, 3.70f, 28);
        worldAngle = PlayerObj.transform.eulerAngles;
        worldAngle.y = 180;
        PlayerObj.transform.eulerAngles = worldAngle;
    }
    // Update is called once per frame
    void Update ()
    {
        if (RoomFlg == false)
        {
            switch (NowRoomNum)
            {
                case 1:
                    PlayerObj.transform.position = new Vector3 (-50, 3.70f, 28);
                    worldAngle = PlayerObj.transform.eulerAngles;
                    worldAngle.y = 180;
                    PlayerObj.transform.eulerAngles = worldAngle;
                    break;
                case 2:
                    PlayerObj.transform.position = new Vector3 (16, 3.70f, 29);
                    worldAngle = PlayerObj.transform.eulerAngles;
                    worldAngle.y = 180;
                    PlayerObj.transform.eulerAngles = worldAngle;
                    Debug.Log ("ON");
                    break;
            }
            RoomFlg = true;
        }
    }
}
Supplementary information (FW/tool version, etc.)

Unity 2019.1.0f2