Hi, I use timeline alot in my project especially to set up shots (See below). I was wondering what is the best practice for doing this when I want the characters in the shot to be Player characters?
I understand that you can rebind the track to the player character at runtime, but how is the best way to preview these timelines in edit mode? Right now I just have a copy of the player characters in the scene do preview it, but I get error messages on the console when I enter playmode that you arnt supposed to have those prefabs in the scene, they need to be warped in. But if they arnt in the scene then I can't preview the timeline in edit mode. Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Using a Timeline-only character is a fair approach - it's the one used by the 3D Primer.
You don't need to keep the Player prefab out of the scene file if it's inconvenient, though. Rather than spawning them in at runtime, you can place the Player in the scene file manually and use that same object within Timeline, avoiding the need to rebind.
If you do want to use a copy of the Player character, and rebind to the correct one at runtime, you can convert your copy into an NPC so that AC doesn't complain about them at runtime. To do this, use the Player's cog button at the top-right and click "Convert to NPC".
Thank you for the answer Chris! One complication to that that I am running into is that AC keeps a record of where the Characters canonically 'Are' in the game correct? (Like which scene they were last in.
Just placing the characters prefab into the current scene doesn't change that, As far as I understand?
So if, during gameplay in this scene I want to switch to one of the characters for which I brought in their prefab, that doesn't currently work cause the game is looking for that character in a scene it last was 'Recorded' So I have to 'teleport in Inactive character', then swap to them, which causes a duplicate of the character in the scene (The Prefab I brought in for the timeline previews and the Prefab brought with the Teleport in Inactive Action'.
Is there a way for AC to detect whatever character prefabs are in the scene upon running of the scene and then update the characters last known (Current scene Index I think is the term used) location to this scene and transition that currently existing character prefab into the Do Not Delete Scene where the rest of the player characters live?
Or am I thinking about this all wrong?
To be clear: these other characters are Players listed in the Settings Manager, with "Player switching" enabled?
If so, you'll need to let AC be in control over where each of the Players are. The Player: Teleport inactive Action is the way to bring a Player to the current scene and have AC record that change.
The same trick of converting Timeline-only characters to NPCs should still work when Player-switching is enabled. But once you've converted to an NPC, they don't need to be "preview only" - they can be used in both Edit mode and runtime without needing to replace via bindings.
'To be clear: these other characters are Players listed in the Settings Manager, with "Player switching" enabled?'
Correct, just upgraded to AC 1.84
"If so, you'll need to let AC be in control over where each of the Players are."
If possible would I be able to get a bit more information on this aspect?
This is the script I worked on to help AC to detect whatever character prefabs are in the scene upon running of the scene and then update the characters last known (Current scene Index) location to this scene. It seems to me working pretty good in the testing I did today, but I get the feeling I'm making things harder for myself down the line or something?
'
// AdoptScenePlayer.cs
// Scene-placed Player adopter for Adventure Creator player-switching.
//
// Key points:
// - Soft-seeds SaveSystem data for the prefab Player ID (scene + pos/rot) WITHOUT claiming the ID.
// - Seeds very early (OnInitialiseScene) so early PlayerSwitch uses correct scene/pose.
// - On spawn, optionally overrides the spawned prefab's pose to match scene instance
// to avoid default PlayerStart placement if a switch happens right at scene start.
// - Adopts transform/data from any spawned duplicate of the same ID.
// - Never switches control during Teleport Inactive; only switches when AC actually sets this ID active.
using System.Collections;
using UnityEngine;
#if !ACIgnore
using AC;
#endif
[AddComponentMenu("BT/AC/Adopt Scene Player")]
public class AdoptScenePlayer : MonoBehaviour
{
#if !ACIgnore
`
` // --- AC early scene init hook: seed BEFORE OnStart ActionLists run ---
private void OnInitialiseSceneHook()
{
if (!Application.isPlaying) return;
endif
}`
When using Player-switching, AC will keep tabs on where each Player is throughout the game - taking care of spawning / removal duties based on what scene is open, and which scene they're supposed to be in.
This is based on its internal data-keeping, so the "regular" way to move characters around is to use Player: Teleport inactive which allows AC to make changes to this data at the same time.
If you want to add/remove Players yourself, you'll run in to trouble unless you use a complex custom script like the one above to update AC's data set to keep things in sync. If you hadn't written one already, I'd recommend against it. But the main thing is to update the SaveSystem's PlayerData, which you are. I haven't tested it myself but it does look thorough.
Ok, great to know. Is there a way to check where AC thinks all the characters are at moment in the game? Like which scenes? I've been using this script, but it only tracks the characters in the current scene
`// PlayerLocationOverlay.cs
// Scene-attached, non-interactive overlay that shows all AC Player instances:
// • Which scene they're in
// • Their world position
// • Which one is the active Player
//
// Attach this to any GameObject in scenes where you want the overlay available.
// Toggle with F10 (configurable). Updates ~1/sec by default.
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
if AC_PRESENT || true
using AC; // Adventure Creator
endif
[AddComponentMenu("BT/Debug/Player Location Overlay")]
[DefaultExecutionOrder(10001)]
public class PlayerLocationOverlay : MonoBehaviour
{
[Header("Toggle")]
public KeyCode toggleKey = KeyCode.F10;
`
` // ---------- Build UI ----------
private void BuildUI()
{
_canvas = gameObject.AddComponent
`
` // ---------- Helpers ----------
private static bool IsSceneLoadedObject(GameObject go)
{
var s = go.scene;
if (!s.IsValid() || !s.isLoaded) return false;
var hf = go.hideFlags;
if ((hf & HideFlags.HideAndDontSave) != 0) return false;
return true;
}
}`
GetAllPlayerInstances will only return a List of Players found within the current scene.
For a given Player ID, you can use GetPlayerSceneIndex / GetPlayerSceneName to get AC's record of their current location.