Page 1 of 1

Error when trying to change Player name in actor field

Posted: Tue Jan 30, 2024 11:53 am
by Sharzia
Hello,

I have an error when I try to change the Player name.
I use the following line of code in my script when the player enter his own name with an InputField:
DialogueLua.SetActorField("Player", "Name", enteredName);
I also tried with the "Display Name"

I have the following error :
NullReferenceException: Table not found in Lua environment: Actor
PixelCrushers.DialogueSystem.DialogueLua.SetTableField (System.String table, System.String element, System.String field, System.Object value) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/DB/DialogueLua.cs:1022)
PixelCrushers.DialogueSystem.DialogueLua.SetActorField (System.String actor, System.String field, System.Object value) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/DB/DialogueLua.cs:1045)
PlayerName.ValidateChoices () (at Assets/MyGame/Scripts/CharacterSheet/PlayerName.cs:64)
UnityEngine.Events.InvokableCall.Invoke () (at <88f69663e9a64d00b2091dd8dfd4d38f>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <88f69663e9a64d00b2091dd8dfd4d38f>:0)
UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:68)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:110)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:385)
I'm not really sure what caused this or if I did something wrong. :/
I tried updating Dialogue system with lastest version (2.2.42).

Thank you in advance if you can help me with this.

Re: Error when trying to change Player name in actor field

Posted: Tue Jan 30, 2024 12:39 pm
by Tony Li
Hi,

Does your scene have a Dialogue Manager GameObject?

Is a dialogue database assigned to the Dialogue Manager?

Re: Error when trying to change Player name in actor field

Posted: Tue Jan 30, 2024 12:59 pm
by Sharzia
I'm ashamed of myself, I just realised what you pointed out. In my character creation scene, I don't have a dialogue Manager, since I don't have any dialogue, I fixed my issue by adding that code in my dialogue scene.

I'm sorry, :(

While I'm here, I noted it's not updating in the inspector, when I select my Player Actor, it's still named Player, but it seems the new name is still saved, is there any way to update to reflect the change?