mostlyhuman
Member
Here is a simplified version of the code producing the issue:
I press a button in the editor inspector that loads values from the NPCTemplate (which is a scriptable object) by calling the InEditorInspectorButtonMethod(), upon pressing the button and running the in editor method the value for loseInterestDistance inside the Behavior Designer Editor will still show 0, but as soon as I hover my mouse over the Behavior Designer Editor window the value will change to what is set in the template, such as 20 (just be moving my mouse from the inspector over to the BT editor). But then if I actually click anywhere in the BT editor window the value immediately reverts back to 0.
I can send a repro project if needed or if you want anymore details or specifics just lemme know. Cheers!
C#:
public class NPCController : MonoBehaviour
{
[ReadOnly] [SerializeField] protected float loseInterestDistance;
protected SharedFloat loseInterestDistanceBT;
InEditorInspectorButtonMethod()
{
behaviorTree = GetComponent<BehaviorTree>();
loseInterestDistanceBT = (SharedFloat)behaviorTree.GetVariable("loseInterestDistance");
loseInterestDistance = NPCTemplate.LoseInterestDistance;
loseInterestDistanceBT.Value = loseInterestDistance;
behaviorTree.SetVariable("loseInterestDistance", loseInterestDistanceBT);
}
}
I press a button in the editor inspector that loads values from the NPCTemplate (which is a scriptable object) by calling the InEditorInspectorButtonMethod(), upon pressing the button and running the in editor method the value for loseInterestDistance inside the Behavior Designer Editor will still show 0, but as soon as I hover my mouse over the Behavior Designer Editor window the value will change to what is set in the template, such as 20 (just be moving my mouse from the inspector over to the BT editor). But then if I actually click anywhere in the BT editor window the value immediately reverts back to 0.
I can send a repro project if needed or if you want anymore details or specifics just lemme know. Cheers!