Forum rules - please read before posting.

Adventure Creator and Puppet Master



  • NullReferenceException: Object reference not set to an instance of an object
    RootMotion.Dynamics.PuppetMaster.Update () (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:1056)

            And here the line in the script: 
        foreach (BehaviourBase b in behaviours) b.UpdateB(Time.deltaTime);

    NullReferenceException: Object reference not set to an instance of an object
    RootMotion.Dynamics.PuppetMaster.LateUpdate () (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:1076)

        And here the line in the script: 
            foreach (BehaviourBase b in behaviours) b.LateUpdateB(Time.deltaTime);

    Thanks a lot for answering again Chris,

    It's nice that it works for Deckard_89 :smile: Happy to hear that! But I think
    I cannot make use of what he does since my scene is switching, am I right?

  • Yes you can use it for scene switching, but instead of using a player start, just use your default player start (which should be in the exact same place as your player root) then Engine: Wait action, something really small like 0.1, then object: teleport action on the character object - but do not check "IsPlayer?" and it should work.

    Of course, make sure the PM Teleport Test script is on your player that you are teleporting.

  • Also, do this:

    Open the Player script, and comment out the line that calls Teleport, in the LoadData function. I forgot I changed this a while back, because AC saves the player position automatically. This might help with scene changes.

  • edited April 2021

    Hi Deckard_89, thanks a lot for answering. I still don't understand where you would put this action. In the scene right before it switches doesn't seem possible, so it could only be after the scene switch which would give a problem since AC already defined which playerstart the player should teleport to. I have over 7 Playerstarts in one scene (meaning there are 7 individual scenes where my player came from). From my understanding (correct me if I'm wrong) you say that the player should be always teleported to the default playerstart and from there teleport with an Action? Am I right? Seems like a hazzle, especially since my camera would first move to the default start and then to the actual start. Also I would have to make a lot of booleans so the action would know where the player came from. Again, maybe this is not what you mean, but I can't understand it otherwise. Correct me if I am wrong. EDIT: I understand that the idea is to put the action into OnStart, but that wouldn't change the problem that I have since it just doesn't fit into the logic.

  • The Action and the PMTeleportTest both aim to achieve the same thing in different ways - they're not intended to be used together.

    @Deckard_89 Was the wait Action still necessary after changing the Script Execution Order? If so, for how long a time?

    Try using the latest PMTeleportTest script instead of an Action, and check the position it reports in the Console. Even if PM does not update correctly, is the position at least correct? It may be possible to delay the PM teleport command by a frame using a coroutine.

    @PurpleShine The error messages are coming from PuppetMaster - you'll need to contact its developer about those.

    Again: at this stage, it's just about finding what works. A solution can be refined once something reliably works. It would be worth testing out the Teleport Action in a test scene - so that we know what works vs what doesn't.

    With each scene having its own Player character, each scene/Player is handled independently. The state of the Player in scene A should have no bearing on the state of the Player in scene B - save for the PlayerStart they use when scene-switching.

  • You're right Chris, after changing the Script Execution Order a wait action is no longer needed. Also, even Player Starts seem to be working correctly for me now, so there is no need for additional Teleport actions in OnStart cutscenes - just put the script on your character and you're good to go.

  • edited April 2021

    Thanks for the help. I'm waiting for Pärtels help - Unfortunately stuck at the moment.

  • Ok, finally - my brother and me worked on it, since he does the programming, we founded the solution. It is fantastic since you can still use prefabs and don't change anything in AC. Basically the following script which was for 50 procent written by Chris IceBox (the teleporting of PM) and 50 procent by my other brother (also named Chris haha), that unparent and reparents PuppetMaster and solves the scene switching problems. Put this on your Player and you are good to go.

    using AC;
    using RootMotion.Dynamics;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PlayerPMActivator : MonoBehaviour
    * AdventureCreator PupperMaster Player Activator
    * Problem: PuppetMaster player container not compatible with AdventureCreator Player prefabs.
    * Resolution/to use: First use PuppetMaster as instucted. Then put PuppetMaster under the Player and
    * make sure it is deactivated by default. Make the player into a prefab and assign in AC.
    * Add this script to the Player.
    * Also:
    * - Make sure this gets executed before other scripts that mess with the Player/NPC.

    private Char character;
    private PuppetMaster puppetMaster;
    void Awake()
        GameObject target = null;
        foreach (Transform go in GetComponentsInChildren<Transform>(true))
            if ( == "PuppetMaster")
                target = go.gameObject;
        puppetMaster = target.GetComponent<PuppetMaster>();
        // Uncomment to put Player itself inside parent GameObject
        //GameObject gn = new GameObject("Player_Container");
        //gn.layer = LayerMask.NameToLayer("Player");
        //gn.tag = "Player";
    private void OnTeleport()
        if (character == null) character = GetComponent<Char>();
        puppetMaster.Teleport(character.Transform.position, character.Transform.rotation, true);
        Debug.Log("Teleported PuppetMaster to " + character.Transform.position);
        character.Transform.localPosition =;


  • edited April 2021

    Glad you got it figured out.

  • Yes, it is great. In this way everyone can donwload PM and use it with AC. :smile:

  • @PurpleShine I tried your script, and it basically works, but there are two serious issues:

    • Character moves very strangely, as though the puppet is constantly colliding with something.
    • A new game object with PuppetMaster is created for some reason, and it is done every time the scene is entered as they get marked DontDestroyOnLoad, so you can end up with many duplicates.

    Have you noticed any of these issues at all, or is it just something with my setup?

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.