Feeling dumb again

I know its maybe a bit dumb to admit to but I ve gotten to a poit where when asked to pause the video and attempt the process on my own I literally cannot figure out what to even begin doing.
I dont understand the differences in the different variable types or even what the difference between “get” and “set” is.
I dont actually understand whats actually happening when using these blueprints. I also didnt understand with the sequence node, how do you know which sections to connect to each pin? Wouldnt they all just go on 1 as theyre connected??

Sorry for the frustrated blurb, Im just starting to feel like my brain isnt made for this. :frowning:

Variable types you just kinda have to remember but there isn’t that many of them.

bool or boolean stores only two values, 0 or 1, on or off, true or false. Think of it like a light switch.
int stands for integer, it stores only whole numbers, 1,2,3,4,5…100,200… and their negatives as well.
float stores any numbers with decimal places, used when higher precision is required.
string stores text
vector2 and vector3 are structures that hold 2 and 3 floats respectively.

Those are the only ones you should really think about for now, once they click so will any others you encounter moving forward.

Get and Set are coding prefixes for methods used to either extract or input data for an object (class/struct).
Any method that begins with “get” will be used to read some value while ones that begin with “set” will be used to, well, set said value.

For example, a GetPosition() method would return the current x:y:z coordinates of an object while a SetPosition() would be used to set the values of x:y:z.
Within an object’s class it could look something like this:

Vector3 position; /* Vector3 stores three values, in this case the x y z coordinates of position */

public Vector3 GetPosition()
     return position;
public void SetPosition(Vector3 newposition)
     position = newposition;
public void SetPosition(float x, float y, float z)
     position.x = x;
     position.y = y;
     position.z = z;

We have a variable of type Vector3 declared for storing objects position, appropriately named position, then we have a GetPosition() method to retrieve what’s stored in that position variable.

Next we have a SetPosition() method, you can see that in its the brackets there is a Vector3 newposition, that’s because when we use (or call) the method we want to pass in the new values for the position variable inside our class. Inside the SetPosition() method we simply assign the newposition vector passed in through the method to the position variable.

Underneath I also included a secondary version of the method (an overload) in case the user would want to input the x:y:z position one by one as float variables.

The “get” and “set” prefixes are a standardized coding practice used by programmers, in theory, you don’t have to use them and could name the methods something like retrivePosition() and applyPosition() and they would work the same, but it would be confusing for anyone but the person who wrote them like that.

So when you see a “Get” it means you’re getting a value and “Set” means you’re setting one. Easy and simple.

As for the sequence node, I didn’t actually know what it was myself so I just looked it up on Unreals documentation:
Sequence Node
It explains it pretty well there.
I can’t see what it’s doing in the context of your course but its purpose is to just trigger a sequence of events in succession. There is no perceivable delay in the execution but the order is always preserved.
This may matter if you need to ensure things are being done in the correct order, like calculating something before spawning an object.

I dont do unreal but I looked up some stuff to better understand Unreal and C++ and here is what I found:

class AMyActor : public AActor

    UFUNCTION(BlueprintPure, Category = "Position")
    FVector GetPosition() const { return Position; }

    UFUNCTION(BlueprintCallable, Category = "Position")
    void SetPosition(const FVector& NewPosition) { Position = NewPosition; }

    UFUNCTION(BlueprintCallable, Category = "Position")
    void SetPosition(float X, float Y, float Z) { Position = FVector(X, Y, Z); }

    FVector Position;

This is an example with Unreal and C++, @VVruba already did a great job explaining “Get” and “Set”.

@VVruba It is probably more beneficial if you post Unreal and C++ related code and not Unity and C#, because the person you are replying to marked this as a Unreal thread, not a Unity one. :slight_smile:

Edit: I realized im not really explaining the code i provided, so if you want me to do that just let me know :slight_smile:

I didn’t post code related to either Unity or Unreal, I just wrote an example of how it works in programming in general.

I did it this way to keep it as simple as possible since the OP is clearly using Blueprints and I wanted to show how it would translate to code to help them understand the purpose. The problem with using code snippets directly from Unreal or Unity in this case is that they have a bunch of other nonsense that could be confusing to a complete beginner.

1 Like

That’s a good point, a complete beginner would make sense just because the syntax and such isn’t fully engraved into the brain, I would have just made this tailored to the language the OP uses if he/she has some sort of experience, because it could be a little confusing if you are doing C++ and come across a C# or a “Universal” type thing. That is just my thoughts though, everyone has their own preferences.

While I don’t have anything to add to Geth’s explanations because they’re very solid. I would like to point out that the Blueprint First-Person shooter course is a “Beginner+” course, at least in my opinion. While beginners can jump in it might be better to start with either the Unreal Blueprint, C++ Fundementals, or at least the first section of Unreal C++.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms