Forum rules - please read before posting.

Instantiated Player Start

Hello, I am trying to figure out if there is a way of using an instantiated player start.

Working in DunGen, and I have a tile that gets generated on runtime which contains a PlayerStart nav object, but it seems like AC can't find it before the nav object is generated. Is there a way to delay finding PlayerStart?

Another option I can think of is having the player start be in the Scene beforehand in a similar room and 'teleport' them to an instantiated marker.

Comments

  • PlayerStart is just a convenience - you can manually teleport the character through script after the scene has completed loading, via the OnAfterChangeScene custom event:

    using UnityEngine;
    using AC;
    
    public class PlayerStartExample : MonoBehaviour
    {
    
        public Transform startPoint;
    
        private void OnEnable ()
        {
            EventManager.OnAfterChangeScene += OnAfterChangeScene;
        }
    
        private void OnDisable ()
        {
            EventManager.OnAfterChangeScene -= OnAfterChangeScene;
        }
    
        private void OnAfterChangeScene (LoadingGame loadingGame)
        {
            if (loadingGame == LoadingGame.No)
            {
                KickStarter.player.Teleport (startPoint.position);
            }
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.