Missing engine component types as blackboard variables and link list UI issue

Hi,

(Unity 6000.0.28f1, Behavior 1.0.7)
When creating a new blackboard variable, you can pick some engine component types but not all of them. For instance, you can create a Box Collider 2D variable, but the Box Collider (the 3D one) isn’t there:

Some other components are also missing, such as Rigidbody. (Edit: Just noticed I can create a Rigidbody variable using the “New Rigidbody…” option in the “Link Variable” list, so this is a UI bug in the balckbord)
Why are some components present but not all of them? My hypothesis is that only the MonoBehaviour one are present, but not the Component one.

Also, when creating a custom Action, if I need a reference to a Rigidbody, creating a BlackboardVariable<Rigidbody> works well, but at the moment to link the field to a blackboard variable, I have to pick in a set of GameObject and other MonoBehaviour variables.
The problem I see is with this approch is that we are going to have lot of GameObject and other MonoBehaviour variables in the blackboard but only some of them have a rigidbody, leading to possible user error. It is possible to pick a GameObject that don’t have a Rigidbody:

I would have prefered to be able to create Rigidbody blackboard variables and only them can be assigned in the UI to a BlackboardVariable<Rigidbody>. If a developer wanted to allow graph designers more flexibility, they could use a BlackboardVariable<GameObject> and get the component from the GameObject in their custom actions code…
Why was it made like that, and is it possible to change this in the futur?

2 Likes

Hi @Pitou22

Thanks for reporting the issue, this is indeed a pretty bad regression :grimacing:
I’ve opened a ticket and this will be fixed in 1.0.8.

A workaround for now is to create the variable using the “New Rigidbody…” option from the node linkfield.

Really sorry for the inconvenience :bowing_man:

Edit: Add ticket link - Actually not a regression.

1 Like

Not 100% sure it’s a regression. I tried 1.0.3 and all of what I describe was already there.

Indeed, I assumed it was working all along because I wrote some test before 1.0 but I was actually using the workaround :sweat_smile:

Well, we will have a look and try to have it working for an upcoming release.

Thanks :slightly_smiling_face:

It looks like it’s an oversight from when I wrote the blackboard initially and I got used to MonoBehaviours so much that I forgot of the underlying Component :sweat_smile:

Lucky for us, all the serialization stuff is correctly done for Component so while we might need to update some UI code, we should be able to easily expose Components! :partying_face:

We’ll try to get a fix for 1.0.8!

1 Like

Hi @Pitou22

I’ve got a fix for it for 1.0.8 currently in review! :slight_smile:

Thank you for keeping me informed :slight_smile:

With this fix, do you also filter the “Link Variable” list to display only the assignable blackboard variables depending on the type? (the second part of my original message)

Hey @Pitou22, no problem!

Unfortunately that’s not doable (unless I’m missing something). The reason being is that we allow you to cast types and we can’t actually test if your GameObject contains a certain component or not during authoring time. What we can (and should do) is add parenthesis on what’s the variable type and make sure it’s ordered so your explicit type is at the top.

Or some other kind of filtering… or categorising…

Okey :confused:
I really like the idea to put the explicit type first!

I think it still possible to filter some of the variables:

In my screenshot, the action variable is of type BlackboardVariable<Rigidbody>. The list displays the New Mono A variable, which is of type MonoA (a MonoBehaviour script just made for testing that do nothing). It’s impossible to cast this variable to a Rigidbody as expected by the action. Furthermore, when I put my MonoA script on a GameObject that also carry a Rigidbody, the action still doesn’t get the link to the Rigidbody.

Given that, I think there is no reason to display New Mono A variable in the list. This can only result in user error/confusion.

Edit: Strikethrough parts I was wrong

Hey @Pitou22 , thanks for the response! Just to make sure, what do you mean “it’s impossible to cast MonoA to a RigidBody”? As it’s a MonoBehaviour, it should be able to do GetComponent which is what our ComponentToComponentBlackboardVariable does and what you should land in at runtime attached to your variable.

If you are assigning a MonoA that also has a RigidBody and you’re not getting your RigidBody at runtime then that’s a bug! :scream:

Can you please confirm? And if so, can you also show what type of object you end up linked to the “Apply Explosive Force” node at runtime?

Thank you and sorry for the trouble! :sweat:

I tested again, and I was the bug :scream:

I don’t know what I missed the first time I tried. This is why I don’t like too much flexibility, there are many way to do errors without noticing while setting up the scene and graph.

It’s working. Sorry for the confusion :sweat_smile:

Haha oh no! But I’m glad we don’t have a bug there

We should definitely improve filtering there and making it clear when you’re casting vs not!

1 Like

I’m going to mark this topic as resolved as I have a fix for the 1st issue and the 2nd one we’ll look into improving the UI/UX there :slight_smile:

I hope that’s ok!