0
Fixed

Un-intuitive constructor name with programmer naming

Lazlo Bonin (Lead Developer) 3 years ago updated 3 years ago 25 2 duplicates

Programmer naming displays constructors as Type.ctor (e.g. Vector3.ctor).

This is not intuitive. It should display, like in C#, as new Type (e.g. new Vector3).

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 2

Your Variables are hanging in the air. You usually call or set them in a start or update.

Please post the code you want to convert here then Lazlo or others in the community may be able to quickly help you.

I'm fairly certain the variables are initialized with the default "Value" set in the Variables Inspector and created when the GameObject is instantiated, so I don't know what you mean by "hanging in the air". These variables will be set in Update( ), once I am able set them by first creating a new Vector3( ) with the latest values from the GetAxis( ) units.

Regardless, pretend I had no variables at all, and for whatever reason wanted to create a new Vector3( ) every time I got Vertical or Horizontal Axis input - there's no way to do that when Vector3.Create is missing.

The code is from the basic Roll-a-ball tutorial. I'll post the code shortly (not at home atm) but the relevant pseudo code is basically:

    public void FixedUpdate()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");
        movementVector = new Vector3(moveHorizontal, 0, moveVertical);
        myRigidbody.AddForce(movement);
    }

using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
    public float speed;
    Rigidbody rb;
    // Use this for initialization
    void Start () {
        rb = GetComponent<rigidbody>();
    }
    
    // Update is called once per frame
    void Update () {
    
    }
    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        Vector3 movement = new Vector3(moveHorizontal, 0, moveVertical);
        rb.AddForce(movement * speed);
    }
}
After some experimentation I found that I could achieve the desired player movement by:
  • dropping all the variables
  • separating the 2 input axes into 2 Flow Graphs
  • adding the input axis value directly to the X or Z component of the Rigidbody.AddForce() call 

If I ever need access to what the movement vector of the player is, well, I don't have that stored anywhere but that's fine for now. Also Vector3.Create as shown in the 3D movement example is still MIA - tried to check for updates and reimport the plugin (said nothing needs importing).

On a Flow Graph just right click and in the fuzzy finder type create vector, you should see create vector 3 (x, y ,z)

Do you find that or is it missing?

+1

Take a look at this, could this help? I too am also starting to learn bolt, so there are most

certainly better solutions

https://youtu.be/IoafA3m_WiEhttps://youtu.be/IoafA3m_WiE

Yep this is precisely what I was trying to accomplish and this all but confirms Vector3 Create is straight up missing from my Bolt fuzzy finder, I will wait for Lazlo to return from his vacation to get his input on this but I suspect I will need to redownload/reimport/reinstall Bolt.

Oh hey that's your channel! I didn't realize you were multicams, thanks so much for making that video!! I thought you had just found some random person's video that covered rigidbodies haha.

You’re welcome. I will be making much more videos as I learn myself.

Deniz, have you tried  doing a fresh install  from the asset store in a clean project? If not let us know if it shows then. 

Pending Review

Hi there! I'm not on my computer so I can't look, but I see you're using programmer naming, which means if I recall correctly that constructor units should be called "new", so in your case new Vector3 instead of Create Vector 3 (which would be for human naming). Can you tell me if you see it under that name?

Also, remember you can always browse the tree when you're not sure of the exact name of the node, so for instance in this case it should be under Codebase > Unity Engine > Vector3.

Pending Review

Hi there! I'm not on my computer so I can't look, but I see you're using programmer naming, which means if I recall correctly that constructor units should be called "new", so in your case new Vector3 instead of Create Vector 3 (which would be for human naming). Can you tell me if you see it under that name?

Also, remember you can always browse the tree when you're not sure of the exact name of the node, so for instance in this case it should be under Codebase > UnityEngine > Vector3.

Hah *facepalm* that's so obvious to me now...

While you're correct that it's the naming convention I picked was the reason Create wasn't coming up, it seems "new Vector3" doesn't yield any fuzzy field results (see below).

Coincidentally earlier today I was browsing the forums about an unrelated query and read this tutorial and as soon as I read your reply here I instantly recalled this sentence that I had previously overlooked: 

Vector3.ctor is an ugly name, and a side effect of one of Bolts greatest strengths, it uses actual Unity code (including the stuff you personally write!) to generate most of its units

As you can see to the left, that gets the Unit I was looking for:


The 2 types of naming conventions is one of Bolt's strongest features, I use Human when teaching Unity with Bolt to kids. However it would be useful if the types were somehow differentiated in the docs and actual software, even something as subtle as Human being in bold text or some other font color would help. I have no doubt I will again run into a situation where the docs are saying one thing and my plugin doesn't have it, and after a few mins I remember this issue and facepalm again XD

Is there an official way to request features here? Should I submit an "idea" post or do something else?

Out of curiosity I checked the Codebase and it's also ctor there, tricky and easy to overlook is all. Probably passed by it dozens of times =P

This has been resolved in the other thread, don't see a way to close/delete this one from my end but this is not in fact a bug =)

Update: Per Lazlo's comment here he considers the "ctor" naming a bug and will keep this ticket open until resolved.

Oh, that's definitely not what I intended the name to be. I'll keep this bug report open to remind me to rename it to "new X" instead of "X.ctor", it's an easy fix. 

Hello Lazlo. I do personally think that a third option is necessary. Not just Human readable and c# readable but also mix readable. It should not matter if I were to search for create or new, I should receive a fuzzy search on all no matter what. That is the whole purpose of fuzzy, just like google.

So turn your Fuzzy into a Guzzy search engine.

Try and type set variable …nothing

Typing set s, should give you at the top set scene variable and ditto for set o, set g, set a and so on.

The most often searched should appear at the top, just like google. So a little more AI in the search would make a very big difference and btw. I desperately need cursor key left to go back through the breadcrumbs, which would make my tutorials much easier to make.

I am still using Playmaker for a project that I am finishing up, but I am now already opening Bolt every day and liking it more and more. My tendency is going strongly towards the fuzzy side and just maybe it will be goodbye Playmaker. So keep up your very good work Lazlo.

Without knowing dick about the implementation, although a mixed option would be great, parsing & displaying what would end up being ~2x as many items (both create and new, human and programmer) would tank performance no?

Most often searches would be a nice to have for sure!

By cursor key you mean arrow key right? My arrow keys are able to navigate the fuzzy finder's breadcrumbs just fine, make sure Num Lock is off?

+1

Hi Deniz,

Not Bread crumbs in the fuzzy finder, rather bread crumbs in the state machine. By going in and out of states I mean.