How to understand the syntax on the Unreal docs?

Something I’ve been struggling with in every lesson that references the Unreal docs is how to apply the syntax example to what we’re trying to accomplish. For example, with the UPrimitiveComponent::SetSimulatePhysics

virtual void SetSimulatePhysics
(
    bool bSimulate
)

And this is how we use it in the TriggerComponent.cpp:

Component->SetSimulatePhysics(false);

There’s terms that are omitted or replaced(?), I don’t know what virtual, void, or bSimulate represents and why it’s not included when written out in VSC. I also don’t understand why some terms are in blue and others in black. It’s a beginner level question, I know, if there’s a doc or video that someone could recommend to better explain how this works I’d greatly appreciate it.

1 Like

This isn’t specific to the Unreal documentation. That’s just how functions are defined. The documentation says that’s UPrimitiveComponent::SetSimulatePhysics meaning it’s a member of UPrimitiveComponent and what you have in your OP shows it’s a virtual function that returns void and takes a bool input parameter.

struct Example
{
    int Square(int Num);
};

int Example::Square(int Num)
{
    return Num * Num;
}

int main()
{
    Example E;
    int Value = E.Square(30);
}

Here Square is a member function of Example so it needs to be called on an Example object. It takes an int and returns an int.

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

Privacy & Terms