I’m in the middle of building onto the AISystem and AIPerceptionSystem. Unfortunately, AIPerceptionSystem::RegisterSenseClass(…) is not virtual.
What I would like to do is add new spawn notifications for senses like the one that exists for pawns already (e.g. WantsNewPawnNotification()). Without the RegisterSenseClass(…) I deem this impossible as of now.
Will AIPerceptionSystem::RegisterSenseClass(…) be virtual in future releases eventually?
I presume you’ve been able to swap out the AIPerceptionSystem class itself? Just in case you haven’t, here’s one way to do it:
Go to your DefaultEngine.ini file, and add the following:
Now replace the “AIModule” with the name of your game’s module, and the “AIPerceptionSystem” with the name of your AIPerceptionSystem subclass.
Now on to your issue - is there any other place you can add this code? Maybe you could do something kinda ‘gross’ and make your own version of RegisterSenseClass and call it manually (i.e. copy the relevant parts into your own function. This can be a bad idea if theirs relies on calls to functions private to that module, but it’s worth a shot I suppose). Are there any delegates triggered for the AIPerceptionSystem to which you could bind this or other custom functions?
EDIT: Sorry I can’t be more specific - I haven’t looked at this class and its functionality as of yet. I might take a peek later out of curiosity Sounds like an oversight on Epic’s part, potentially, although maybe you’re missing some ‘intended’ way of adding what you’re wanting.
Collaborative work in teams. We’re not editing source code ; O.
Thanks for the reply .
There’d be of course ways to overcome this. I could overwrite UAIPerceptionComponent::OnRegister() for example. But it all seems dirty as I’d simply like to make additions to senses’ functionalities which need to be addressed when registering the class with the PerceptionSystem.
There are no delegates triggered as far as I can see. This could be another nice way aside from making it virtual.
I was hoping to get a response from Epic whether or not they will make it virtual or not. I only makes sense, imo.
Edit: Probably a delegate/function call would be even better, since a sense is only registered when it’s not yet instantiated. Thus a function call to OnSenseRegistered would be ideal.