Forum rules - please read before posting.

Controlling GameCamera2DDrag in Actionlists

Is there any current functionality for teleporting or moving the Drag Camera in Actionlists? I've been playing around with this but haven't found any funcional solution at the moment.

For example, if my main camera in a given scene is a Drag camera, it always exists in its default location at the start of a scene. If I have multiple PlayerStarts in that same scene, is there any current functionality for teleporting or focusing the camera on a particular PlayerStart? If no, do you have a suggestion for how to best achieve this?

Using Unity 6000.4 and AC 1.86.1.

Comments

  • This camera type has a SetPosition function that can be called from a custom script. Here's an example script that uses it to move the camera to a PlayerStart:

    using UnityEngine;
    using AC;
    
    public class MoveDragCamera : MonoBehaviour
    {
    
        public GameCamera2DDrag myGameCamera2DDrag;
        public PlayerStart myPlayerStart;
    
        public void DoMove()
        {
            myGameCamera2DDrag.SetPosition (myPlayerStart.transform.position);
        }
    
    }
    

    To run custom code from an ActionList, you can use the Object: Call event Action and reference the GameObject that the script is attached to.

  • Perfect, thank you!

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.