0
Answered

Trouble with obtain variables from Objects Variables

Aleksandr Zhdanov 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 9

picture for explanation

How do I get the name of the IsActive variable from the OnlyVars object (number 1 in the figure), without entering its name in the GetVariable (number 2) field, like, the way it works for a variable from Scene Variables (number 3)? Is it possible to realize this feature?


Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by Aleksandr Zhdanov 2 years ago

Unfortunately, object variables do not get listed in the fuzzy finder like other types. I assume because the object you're getting it from can be changed at runtime. You can't change where a scene, graph, application or saved variable is located, because that never changes. So therefore a hard list of variables isn't real.

+1
Escalated

This is exactly the reason, but I'm sure we'll all agree it's very annoying!

I'm thinking of ways to generally improve the variable selection workflow (apart from variable drag & drop, obviously). Other things are also not optimal in terms of workflow at the moment (changing the kind of variable we're getting but not the name, renaming a variable, etc.), but rest assured improving that is on my mind. 

+1

Replied at th same time. As your the dev I'll buy you a round. 

You keep offering that, one day I'm going to say yes! :P

If you're ever in Montreal... ;)

HA. True, now it is two rounds I owe you. When I get back from Italy in Nov I will make  my next excursion to Canada. Have not visited Montreal yet and it is on my list.

> changing the kind of variable we're getting but not the name, renaming a variable
This!
It's my another question, which i didn't have time to ask :-)  How realistic is the implementation of such refactoring tool? This seems to be a difficult task, because I have not seen such a tool in the products of  your competitors.

+1

It may seem simple, but it's an incredibly complex task. Why? Because there is no single codebase. Graphs and variables are spread across:

  • Macro objects
  • Machine objects across various scenes
  • Nested graphs in each of these objects

For example, you could have variables that are used in a prefab override on another scene than the currently loaded one, and to find and rename those, you have no other way than:

  1. Save the current scene
  2. Load every scene
    1. Check every object in the scene
    2. Check if it has variables
      1. Compare & rename variables
    3. Check if it has one or more machines
      1. Recursively check in every nested graph of the machine
        1. Check for every Get/Set variable unit
          1. Compare & rename variable name field
  3. Check in every macro asset
    1. Recursively check in every nested graph of the macro
      1. Check for every Get/Set variable unit
        1. Compare & rename variable name field
  4. Reload the current scene

The ideal solution for this is not to actually do this crazy iteration (which I have to do at the moment for AOT stub generation, for example), but rather move towards a unified graph library instead of having macros & machines. This is however a gigantic change in architecture and will not come anytime soon.

+1

When  he adds the drag and drop variable in an upcoming update that should solve that issue.

Answered

This will be possible in the next version with many improvements to the variable workflow. For example, a dropdown will be included in the variable name field.