Closed androvisuals closed 2 years ago
Hey, I was unable to reproduce this using the same code. Some suggestrions I have:
MonitoredBehaviour
and register the object in Start.Start
a second time.MonoBehaviour
, check if there is more than one instance of it in your scene. MonitoringManager.UnregisterTarget(this);
in OnDestory.If it's still not working I would need a little bit more information about version, what you class is inheriting from etc. Hope that this may help :)
Hi there, So it was my mistake. I have a class where I use override behavior. So it was getting called twice on start, even though I "only" had it inside the start function of the class ;-)
I now moved the MonitoringManager code to the class the rest inherit from and it all appears only once, and now works perfectly across all the scripts that use it. The code below is to show what now works correctly for me. An amazing asset, glad you've shared it with the world <3 Thanks for the speedy reply and help!
using Baracuda.Monitoring.API;
public class StateAI : MonoBehaviour
{
public Soldier soldier;
protected virtual void Start()
{
MonitoringManager.RegisterTarget(this);
}
public virtual void AwakeSoldierAI() { }
public virtual void StartSoldierAI() { }
public virtual void UpdateSoldierAI() { }
public virtual void LateUpdateSoldierAI() { }
}```
using Baracuda.Monitoring;
using Baracuda.Monitoring.API;
[Monitor] [SerializeField] int aggroCounter = 0;
[Monitor] [SerializeField] float decisionScoreForCover = 0;
in Start I have
MonitoringManager.RegisterTarget(this);
this results in the fields appearing twice. Shouldn't they only appear once? I removed the SerializeField attribute but this didn't change anything. Any and all help appreciated.