Skip to content

Prevent state from being actorless #15

@NicoooByte

Description

@NicoooByte

OS
Windows 10

Unity
Unity 2021.2.0f1

DialogueGraph
2.0.0

Description
If the state has no actor, the following error occurs:

System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <7b5f9a2f7db343a4ab54846ed680277b>:0)
DialogueGraph.Runtime.RuntimeDialogueGraph.GetCurrentActor () (at Library/PackageCache/com.github.teodorvecerdi.dialoguegraph@2.0.0/Runtime/RuntimeDialogueGraph.cs:68)

originating from "RuntimeDialogueGraph.cs"

public ActorData GetCurrentActor() {
            var currentNode = DlogObject.NodeDictionary[currentNodeGuid];
            if (currentNode.Type != NodeType.NPC) return null;
            var currentNodeActorGuid = currentNode.ActorGuid;
            var actor = CurrentData.ActorData[CurrentData.ActorDataIndices[currentNodeActorGuid]]; // <- Throws error
            return actor;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions