Ok. I created a new UCC scene and added a brand new Player and AI agent. Here is what I found after assigning the enemy character to the health attribute monitor:
- If the player is disabled, and if i l let the AI agent fall, the health bar will update accordingly
- If the player is in the scene activated, then the healthbar does not update
In my own game scene though, even if I created a brand new AI character, and even if I disable my player character, the bar does not update.
I tried adding a Debug.Log right after base.OnAttachCharacter(character), and I do see it being executed. But I am also getting the following error message:
Error: The UI element Health cannot find a character.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.UI.CharacterMonitor:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/UI/CharacterMonitor.cs:47)
Opsive.UltimateCharacterController.UI.AttributeMonitor:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/UI/AttributeMonitor.cs:38)
I cannot really see what is going on.
Why does the monitor track the player when character is null in the first place? There is no reference to the player tag in the entire code for the Attribute Monitor, or the HealthFlashMonitor. What makes it choose the player automatically? From the clean scene it does look like the problem is having the player in the scene.