FindSmartObjectTask on a State Tree does not find SmartObject

Hello, I have a question about Mass, State Trees, and Smart Objects.

So currently, I have a setup where my Mass Entity Spawner is spawning actors. The actors have been configured in the Entity Config to use a State Tree as their behaviour. In the State Tree, there is a FindSmartObjectTask.

When I set up a level with a single SmartObject and try this, it does not find the SmartObject.

I put a breakpoint in USmartObjectSubsystem::FindSmartObjects and that breakpoint never gets hit, so for some reason we never even execute that code, although I have confirmed that we are entering the node that executes this task.

Here is the setup of my State Tree. Any help would be appreciated. Thank you!

Hello, I have a question about Mass, State Trees, and Smart Objects.

So currently, I have a setup where my Mass Entity Spawner is spawning actors. The actors have been configured in the Entity Config to use a State Tree as their behaviour. In the State Tree, there is a FindSmartObjectTask.

When I set up a level with a single SmartObject and try this, it does not find the SmartObject.

I put a breakpoint in USmartObjectSubsystem::FindSmartObjects and that breakpoint never gets hit, so for some reason we never even execute that code, although I have confirmed that we are entering the node that executes this task.

Here is the setup of my State Tree. Any help would be appreciated. Thank you!

[Image Removed]

Steps to Reproduce

Have you set up the SmartObjectAnnotations for ZoneGraph in your level? There is an annotation component that need to be added to an Actor and then placed into the level. Here is a little article about how to set it up: Configuring ZoneGraph to Work with Mass Smart Objects. If it is still not working after adding the annotations and tags, can you share out your Smart Object definition and level so I can check if the problem may be elsewhere other than the StateTree. I just ran a quick test to make sure I could have a simple StateTree in Mass wander and randomly use Smart Objects and it was running.

-James

Hello James,

I’ve been working on this, and I am sure I’ve set up the lane profiles and tags as required. In the FindSmartObjectTask, I had initially left the Tag blank, because I thought that meant it would search for any and all SmartObject, which would be fine because we only have one in the level. I have also tried adding the tag, and it hasn’t worked.

I have attached here the Smart Object definition for our smart object.

Thanks,

Sean

And this the level with the details of the zone shape

On your SODD, add an Entrance entry to the Slot’s Definition Data. This will be where the annotation for the Smart Object on the lane is created. Smart Objects require the entrance to be defined. I believe that should allow for the Smart Object to be found and used. And is your Play Animation Definition subclassed from USmartObjectMassBehaviorDefinition? You may want to start with a basic Mass definition to limit what factors may be causing the issue.

So, I’ve added the Entrance entry to the Slot Definition Data, and also changed the Behavior Definition to just a simple Smart Object Mass Behavior Definition, with nothing else.

So far, it still doesn’t work, and I also tried adding a Tag in the Entrance Definition Data, to no avail.

I’ve attached the screenshot of the updated SmartObjectDefinition.

What else could I be missing?[Image Removed]

That is odd. One last thing I can think to try at the moment. If you go to your Smart Object Actor in the level, select it and then the Smart Object component from the Details panel. Enable the flag for Can Be Part of Collection. You don’t need to make it part of a collection or add a persistent collection to the level, but it seems this setting may be needed for Mass Smart Objects.

I have tried that and it doesn’t work as well.

Just to be clear, let me describe what I mean when I say it “doesn’t work”, just so we’re on the same page.

When I start playing the level and turn on the AI debugging, I can see the entity going straight to the Wander node, and stays there forever.

When I set a breakpoint in USmartObjectSubsystem::FindSmartObject and USmartObjectSubsystem::FindSmartObjects, I can see none of them ever get hit.

If this makes sense, is there any way we can get a bit more of an involved pair of eyes on this?

I am trying to correctly guess what is missing from your setup, but my information on what you currently have is limited to only the StateTree hierarchy, ZoneGraph shape, and the details for the Smart Object definition’s slot.

Here is what I have in place to get this to baseline work with a project from our UE5 Main branch. Here are some screenshots of the entity config, Smart Object Definition Data, and MassStateTree I am using. In addition, I put the ZoneGraph annotation actor into the level and enabled the flag for Can Be Part of Collection on the Smart Object component of the Smart Object Owning Actor. With only this setup and a singular ZoneShape (no configuration other than dropping into level and giving the default lane profile), the NPCs would wander the ZG shape and claim/use the SmartObject. You will not likely have the MRUSlotsFragment for your entity config, and that is okay as it is an added feature in 5.7 and not required for Mass Smart Object use in 5.5.

Entity Config:

[Image Removed]

StateTree:

[Image Removed]

Smart Object definition:

[Image Removed]

Thanks James, and sorry for the late reply. I am going to clean everything off and start from scratch again and see if this works.

If you are still encountering problems with setting this up on your next attempt, you may reach out to your account manager to set up a call with us to help walk through the setup.

-James

Thanks James, we will see where we get to and then liase with George if need be