MonoBehaviourTree icon indicating copy to clipboard operation
MonoBehaviourTree copied to clipboard

Improve blackboard variables

Open laicasaane opened this issue 1 year ago • 6 comments

Some possible improvements:

  1. Allow copying selected variables from master blackboard to sub blackboards. To reduce the amount of manual typing and selecting variable type!
  2. Allow copying variable names. To support some other usecases where I need the names but typing them is a labour I want to avoid. The current workaround is opening the Inspector in Debug mode and looking for the component.

laicasaane avatar Aug 17 '24 09:08 laicasaane

A thought on copying variables from master blackboard: maybe we can use references from the master instead of adding new variable components on the sub tree to reduce the amount of MBs.

laicasaane avatar Aug 17 '24 10:08 laicasaane

Hi

  1. Do you mean some spcial function like button/dropdown? How this would work?
  2. I understand this as making variable labels (names) as selectable, correct?

A thought on copying variables from master blackboard: maybe we can use references from the master instead of adding new variable components on the sub tree to reduce the amount of MBs.

Can you elaborate further?

Qriva avatar Aug 20 '24 12:08 Qriva

  1. For example, my character has a master blackboard with many variables

image

And the "Attack" sub-tree needs many variables from the master blackboard (all, except the attack_input) image

So currently I have to do these steps to "copy" a variable from the master blackboard to this "Attack" blackboard:

  • type the variable key
  • select the variable type
  • click "Add" button

So I imagine if we have a "Copy from Master" button that will be enabled if there is a reference to the master blackboard: image

This button will show a list of master variables, each with a checkbox, something like this: image

We choose the variables to be copied, click "OK" and then: a. New variable components will be added on the sub-tree GameObject and their references will be added to the list, or b. Only the references to the selected ones will be added to the list. No new variable component will be added on the sub-tree GameObject.

I prefer 1b because ultimately the variable list only stores the references: image

With 1b we can reduce the number of components on the sub-tree GameObject.

laicasaane avatar Aug 20 '24 13:08 laicasaane

  1. There should be another menu item labeled "Copy Key".

image

laicasaane avatar Aug 20 '24 13:08 laicasaane

I admit that not being able to copy key is a bit bothersome, for me too and I guess the best option would be to make labels selectable, so it's possible to double click and copy name. I think I am going to check it soon.

When it comes to copy of variables from other blackbloard, it's not so complicated, but it requires more work, especially example with custom popup. I think it's good feature when seen in the current context (state of tool), but I don't think I have time to revisit this problem right now. To be honest the current implementation of subtrees and their blackboards is really clunky 😅

Qriva avatar Aug 20 '24 22:08 Qriva

I wanted to make the label selectable, however I encountered small problem. Selectable label has no tooltip and I use it to display variable type on hover. For this reason I added "Copy Key" in dropdown, but It would be better to implement this a bit better. On top of this I added option in component menu to "Log Variables" and it lists all variables in the console: obraz b79b1b809999fe5fcf7b88d0d67417159a2e37a3

Qriva avatar Aug 25 '24 19:08 Qriva