PUN Networked Quests

Announcements, support questions, and discussion for the Dialogue System.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: PUN Networked Quests

Post by nathanj »

Hi Tony

Seem to be revisting things I thought I had working, but apparently did not :roll:

I have a Custom Sequencer command that I'm trying to send a message to the Master Client NPC to trigger a Behaviour Tree but for some reason it is not working. You mind having a look over this and see if anything stands out to you?

If I have this sequence command in the Sequencer Field on the Dialogue Node, I get this error:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Character.PunLookSource.OnPhotonSerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Scripts/Character/PunLookSource.cs:172)
Which looks unrelated to DS, but this error only happens when I have the Sequencer Command in the field, if I remove the command I do not get the error.

The Command Code:

Code: Select all

namespace PixelCrushers.DialogueSystem.SequencerCommands
{

    public class SequencerCommandStartPUNBT : SequencerCommand
    { // Rename to SequencerCommand<YourCommand>
        Transform subject = null;
       

        private void Start()
        {
            string action = GetParameter(0);
            string group = GetParameter(1);
            subject = GetSubject(2);
            string name = subject.name;
            PhotonView photonView = PhotonView.Get(subject);
            photonView.RPC("TriggerPUNBT", RpcTarget.MasterClient, group, name, action);
            Stop();
        }


        public void OnDestroy()
        {
            subject = null;
            // Add your finalization code here. This is critical. If the sequence is cancelled and this
            // command is marked as "required", then only Awake() and OnDestroy() will be called.
            // Use it to clean up whatever needs cleaning at the end of the sequencer command.
            // If you don't need to do anything at the end, you can delete this method.
        }

    }

}
The Sequencer Commands

Code: Select all

StartPUNBT(start,2,npcName); {{default}}
And the PUN RPC I should mention, in the these examples, the "string action = GetParameter(0);" from the Sequence code is not actually used in this RPC.

Code: Select all

    [PunRPC]
    void TriggerPUNBT(string group, string name, string action)
    {
        int groupNumber = int.Parse(group);
        foreach (BehaviorTree tree in bTs)
        {
            if (tree.Group == groupNumber)
            {
                tree.Start();
            }
        }
    }
As always, your help is most appreciated.

Nathan
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: PUN Networked Quests

Post by Tony Li »

Hi Nathan,

If you can reproduce this in the Unity editor's play mode, would you please click on the NullReferenceException error in the Console window, press Ctrl+C to copy its details to the clipboard, and paste it into a reply?

If you can only reproduce it in a build, locate that error in the Player.log file and copy-paste its entire stack trace into a reply.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: PUN Networked Quests

Post by nathanj »

Hi Tony

Yeah, it's weird because there is nothing to indicate that it is DS related yet it only happens when I have the Sequencer Command in the Sequencer Field.

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Character.PunLookSource.OnPhotonSerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Scripts/Character/PunLookSource.cs:172)
Photon.Pun.PhotonView.SerializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:753)
Photon.Pun.PhotonView.SerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:717)
Photon.Pun.PhotonNetwork.OnSerializeWrite (Photon.Pun.PhotonView view) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1721)
Photon.Pun.PhotonNetwork.RunViewUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1650)
Photon.Pun.PhotonHandler.LateUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:173)
Thanks
Nathan
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: PUN Networked Quests

Post by nathanj »

If you want, I could make up and send you a project with all this.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: PUN Networked Quests

Post by Tony Li »

That would be a big help. Would you please send the repro project to tony (at) pixelcrushers.com along with the steps I should follow to reproduce the issue? I can set up a PUN AppId. You don't need to reveal your AppId.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: PUN Networked Quests

Post by nathanj »

Is Unity 2019.4.20 ok, or you have a preference?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: PUN Networked Quests

Post by Tony Li »

Any version's fine, but the version you're using in your main project is ideal because it will best replicate the issue you're seeing.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: PUN Networked Quests

Post by nathanj »

Hey Tony

I'm gonna have to get this to you next week, sorry, it's Saturday here and I don't have time to go through this all atm

Thanks for your time,

Nathah
Post Reply