Why use a service for the last seen location?

Why would you use a service here for the Last seen location?

Instead of a service, I just hooked into the AIPerceptionUpdated event. If successfully sensed is set to false, I save the Stimulis location as the vector Last known location in the blackboard data. It works great and without any hassle (Or often called functions like the service in the example).

What would be the benefit of using the service instead?

3 Likes

I dont know if there is a specific unreal reasson to use a service but from a course point of view its purpose is to teach you about both AIPerceptionUpdated and services.
Its said thoughtout the course thats there is more than one way to do things and that you found another way that works for you is great! Its shows you are thinking!
Also you never know whats coming in the coming lectures so it may be that it spans accross into another video and the reason is there (Like those groans lovely refactors)

Nice. AI perception update can also take care of setting focus and clearing focus more reliably.
It’s good to know about services however they are not efficient in this case (Guard Behavior selector).

I attempted to pull the data directly out of the AI Perception component inside the service but it doesn’t look like it has the data out of cycle of the AI perception events. So that’s another strike against doing it in a service in my opinion. Passing data between a service and a component via a Blackboard variable feels like a bit of a brittle and unclear contract to me.

Privacy & Terms