- Home /
 
 
               Question by 
               SesshogeGames · Jan 11, 2019 at 03:21 PM · 
                2d gamerpgload scenespawnpointstitle  
              
 
              Start points don't work when I switch from the title screen, to the playable scene
Here is my problem now. I added a title screen to my game, and when I load to the original scene, the starting points only work once. Then it starts going by my position from the last scene, what is the problem? It works fine when I load it without the title screen.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class PlayerStartPoint : MonoBehaviour {
 
     private PlayerController thePlayer;
     private CameraController theCamera;
     private PartyMemberFollowController partyMember1;
 
     public string pointName;
 
     // Use this for initialization
     void OnEnable () {
         thePlayer = FindObjectOfType<PlayerController>();
         if (thePlayer.startPoint == pointName)
         {
             thePlayer.transform.position = transform.position;
 
             theCamera = FindObjectOfType<CameraController>();
             theCamera.transform.position = new Vector3(transform.position.x, transform.position.y, theCamera.transform.position.z);
 
             partyMember1 = FindObjectOfType<PartyMemberFollowController>();
             partyMember1.transform.position = transform.position;
             Debug.Log("Started at " + pointName);
         }
     }
     
     // Update is called once per frame
     void Update () {
         
     }
 }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Setting start point for player 2d 2 Answers
2D RPG Jumping 0 Answers
DontDestroyOnLoad duplicate prevention code is deleting the original player 2 Answers
how to load a different save position in different scene? 1 Answer
NPC Party Member Direction 1 Answer