crashkonijn / GOAP

A multi-threaded GOAP system for Unity
Apache License 2.0
1.16k stars 127 forks source link

Bug: GoapSetBehaviour reference in AgentBehaviour component is set the same for all agents on scene start when there are multiple GoapSetBehaviour in the scene #153

Closed nfetissow closed 7 months ago

nfetissow commented 7 months ago

Describe the bug I have the following setup:

What happens is that all AgentBehaviour components that are attached to my NPCs receive the GoapSetBehaviour component from GO3 when the scene is loaded, no matter what I configure with references in serialized field Goap Set Behaviour. If I disable GO3 and load the scene, the melee agents have the melee sets as it is setup in the editor. My workaround is setting the desired behaviour sets by script.

Expected behavior The references to GoapSetBehaviour that are configured for AgentBehaviour in the scene do not get scrambled when I enter play mode.

Unity Version 2022.3.2f1

Unity.Collections Version 1.2.4

Package Version 2.1.19

crashkonijn commented 7 months ago

Thank you for the bug report!

nfetissow commented 7 months ago

@crashkonijn reached out to me and it turned out that a line in my project was assigning the field to all NPC controllers in Awake(). The library works perfectly well :)