Page 1 of 1

[HOWTO] How To: Sequencer Command To Change Original Recorded Camera Position

Posted: Sun Nov 12, 2023 3:55 pm
by Tony Li
When a conversation starts, the sequencer records the camera's original position. (Technically this happens when the first camera movement sequencer command runs.)

When the conversation ends, the sequencer moves the camera back to the original recorded position.

If you don't want the camera to return to its original position at the end of the conversation, there are two options:

1. Use MoveTo() sequencer commands to move the camera instead of using Camera() commands.

2. Or write a sequencer command that sets the original position to the camera's current position. For example

Code: Select all

using UnityEngine;

namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandSetCameraHomePosition : SequencerCommand
    {
        void Awake()
        { // (Assumes one conversation running at a time.)
            var sequencer = DialogueManager.conversationView.sequencer;
            sequencer.originalCameraPosition = sequencer.sequencerCameraTransform.position;
            Stop();
        }
    }
}