Mass smart object tasks handling smart object disabled.

When disabling a smart object the FMassClaimSmartObjectTask and FMassUseSmartObjectTask don’t seem to respond to the slot/object being disabled. The UE::Mass::SmartObjectOnSlotInvalidated doesn’t get hit if the slot is disabled. If I destroy the object it reacts and things get aborted/handled as expected, just not for being disabled.

Should it be?

It seems like FMassSmartObjectHandler::ClaimSmartObject should probably bind to GetSlotEventDelegate and handle more than just the invalidation or should disabling a Smart object invalidate the slots?

Hmm… we did not end up using Smart Objects in The Matrix Awakens with Mass, so this might be a case we had not accounted for happening. Disabling a Smart Object should invalidate the slots, and slots becoming invalid should be handled by the tasks as well. I believe this is something that was missed in our initial setups.

Can you share a few steps for how best to repro this? I know there are talks of removing the Smart Objects currently in use in City Sample’s MassCrowd level as they no longer work properly since the Contextual Animation plugin has been changed significantly to break backwards compatibility (it is still experimental).

-James

Just copy the crowd state tree from the city sample, the find SO->Claim SO->Move To-> Use SO part.

When the agent is in a smart object, disable it and notice they don’t get cancelled by the FMassSmartObjectHandler. The reason seems to be release doesn’t get called on disabled.

It gets hit from:

USmartObjectSubsystem::MarkSlotAsClaimed

USmartObjectSubsystem::MarkSlotAsFree

USmartObjectSubsystem::AbortAllInternal

I think the slot should also get released on deactivate?

Calling AbortAllInternal in USmartObjectSubsystem::SetEnabledForReason if were not enabled right before the “notify if needed” section works as a solution for us. Would you be open to a PR? It seems like a bug to not call abort if we’re switching to disabled.

We would certainly appreciate it as a PR! It seems like a bug to me as well.

Excellent, I’ll wait to hear back on a couple of my other questions and submit the ones you’re interested.

Speaking with the team about this today, and they believe this was an intended behavior. Back in 5.0 and The Matrix Awakens, this was changed so that entities already using the slot could have a smooth exit from the Smart Object. The details are a bit fuzzy due to time since it was implemented and the dev who made the change is no longer at Epic. We would need to investigate the change to see if there is a behavior that might break, but we are removing the contextual animation Smart Objects from City Sample which would likely have been the most affected tech by the change.