The real issue is that Unity is a VDE—a “Visual Development Environment”.
The trick is making the interactivity—the code—visible in some way, so that you’re not having to jump out of Unity to mess with scripts. This isn’t a trivial problem to solve. Finding a way to overlay Finite State Machine connections over an arbitrary entity in a 3D scene is difficult.
Take the 3D Platformer Tutorial (also known as “Lerpz Lives”. It’s in the Resources section.)
A GameObject can have multiple scripts attached, in any Mono-capable language. If I click on the Lerpz character in the scene, I don’t get any feedback about how that character interacts with the robots, with the platforms themselves, with the jetpack… with anything. The interactivity is completely opaque. It’s just another asset. I have to open up each attached script in turn and read it myself to work out what’s going on. This isn’t even slightly visual.
And yet, it’s that very interactivity which defines a game.
Note that this applies to all VDEs, not just Unity: all AAA-capable engines have the exact same problem. Yes, even those which use “Visual” scripting! All you’re doing there is removing the syntactic sugar; the scripting is still going on. And scripts are a poor representation of a Finite State Machine anyway. As long as you’re only showing one script at a time, and relying on the developer to parse each script in his head to work out what it’s interacting with, you’re doing it wrong.
A solution to this issue is going to be hard to come by. I have a few thoughts on the matter, but even my 3D Scripting system suggested earlier is only a partial solution at best.
Rather than stop here, I’ll describe a possible alternative:
My view is that a State-focused UI makes the most sense.
Each GameObject should have both built-in and Custom States. (All animatable Properties in the present UI would be States in my UI.)
The built-in States would be those related to the various engines—Physics, Lighting, Rendering, etc.—while the Custom States would be those which represent the GameObject in your game and are defined by you. E.g. “Character Health”, “Current Weapon”, “Ammo”, “Jetpack Active”, “Inventory”, etc.
In addition, you’d have Event States—“Scene Update”, “Controller State”, etc., which link the GameObject with system-wide States such as the status of the input controller(s), the renderer’s refresh cycle, application status, and so on.
Rather than attaching scripts to GameObjects, you would attach scripts to each of these States. The States would appear when you selected a GameObject in the Scene, either directly in the Scene in the form of interactive widgets, and / or somewhere in the Inspector. In the latter case, a button would be displayed alongside each State, which would change its appearance when a State Change script is attached.
Right-click on the “force field” part of the 3D Platformer Tutorial’s scenery and up pops a menu containing the built-in States, including those related to the texture’s UV coordinates. Click on it to add a 3D Script to animate that texture. Next time you right-click on that force field, the “Texture UV” State would be at the top of the menu—along with any other States that have scripts attached—making it clear that this State is now interactive, as well as making it easier to get to the visual script to make further changes.
At the very top of the pop-up menu is a “View All Scripts” entry, which switches to the 3D Script window showing all the States and Scripts, with lines linking those which talk to each other, and off-screen lines showing connections with States of other GameObjects. Zoom out and all those linked GameObject also appear. Zoom in on one of those and you get the same “All Scripts” view for that GameObject. With this, you’ll be able to follow all the interaction “wiring” in a visual 3D diagram, rather than having to pore over each script and interpret it yourself.
There are a lot more optimisations and details I could go into, but this post is already long enough, so I’ll shut up now.