0

Request Features: Graph Text box similar to // on scripts -Concept art included-

Joshua Dudley 1 week ago updated by Thomas S. 6 days ago 1




its a simple text box attached to the top of nodes that has an on / off switch on it. the switch could easily be put in the inspector if you didn't want to change the look of a node when its turned off. and it should also have some additional text options in the inspector including text color, size, and maybe text box width and height.

more important then that is a group box that you can take notes in. it's very simple and clean

I'm not very good at programming and either of these ideas would help me a lot and I think they would help with making and understanding tutorials.

ps.
bolt might even have a way to achieve this same thing already and I just haven't found it yet....if so just ignore me lol
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

In most cases you shouldn't use that requested feature. And I will explain you also why. 

What you are requesting are so called Single-Line-Comments. If you feel the need to use them it is a really good sign that you are doing something wrong. From my experience in over 90%. I will explain it based on code.

One of the most used cases is to explain what will happen in the following lines of code. E.g:

public void Buy(Item item, int amount) {
// Calculate Price for Item
var price = item.Price * amount;

if (GetsBonus(item, out var bonus)) {
price += bonus;
}

// Subtract price from account
var account = GetAccount();
account.Gold -= price;
}


This has some downsides:

  • It is not a contract. Everyone can add code in between which is not related to the task of that section (very likely if you work in team).
  • The method can become very large (I've seen way to often methods with houndreds of lines of code) because people tend to follow the existing style.
  • The code is not reusable
  • In case when the method grows - the code becomes less and less test- and refactorable 

An easy way to solve this is to extract everything to methods. The single-line-comments are a great hint. You can just take their name (may adjust it a little bit) and move everything below to its own method:

public void Buy(Item item, int amount) {
var price = CalculateFinalPrice(item, amount);
BookPriceFromAccount(price);
}

As you can see: the code now explains itself. It is better readable and the method-name can be your contract. (If you want to have a hard contract you have to write tests).

And with Bolt you can aim for the same solution:

  • You can group your nodes (the name of the group = name of the method). That actually would be like a private method
  • You can move your code to a Super-Node/Flow-Makro. So it becomes reusable and would be like a public method

Of course comments are also used to describe certain methods and classes. Well that is also possible with bolt. Cause (State|Flow)Machines and Super-Units/Flow Macros provide a description field. So you should be able to document every public functionality. 


Just that one don't get me wrong. I'm not against having such feature in bolt (hopefully discreet designed). I just wanted to point out: from the programmers point-of-view you don't really need it ;-)