Download

Can you teach me how to fish so that I can't eat

Hi,

Yes, I know that was a crazy title, but I’m having some difficulties. Also, I can’t edit and fix the the word can’t, my typo. I was looking at some sample code and this is what I found:



CameraBoom->AttachTo(RootComponent);


and the documentation for that is this:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/USceneComponent/AttachTo/index.html

How in the world was I suppose to figure out that I had to just pass in RootComponent into the AttachTo function. Looking at the reference, it passed 4 parameters too.

It was another situation when I checked a particular class and a variable was not listed on that page, when I searched the whole API, the variable showed up for that class, but it wasn’t a link for that
variable on that page.

Basically, I really want to get good at programming and I don’t feel like the API reference is descriptive enough for me to use. If you feel that if I would had known C++ a little bit better that I would had
been able to come to this CameraBoom->AttachTo(RootComponent) from this reference:



void AttachTo
(
    class USceneComponent * InParent,
    FName InSocketName,
    EAttachLocation::Type AttachType,
    bool bWeldSimulatedBodies
)


please let me know. I did take a course in college for C++ and went through lynda’s C++ course and I have a good understanding of C++. But I feel like an API should at least tell you what parameters to put in and what
it does. It should also have a note section that a programmer should know if it would prevent the code from working correctly.

So basically, with the limitations of the API reference, can you tell me how you were able to get good at programming in Unreal Engine with not very useful documentations out there.

Please know that I’m not bashing the creators of the API; I just want to know how to get good at Unreal Engine programming. Thanks.

That is the correct function, the very same one.

RootComponent() just returns a Scene Component, so it acts as the first parameter. If you look at the function in code, the rest of the parameters have default values, so you don’t have to put something in there for each entry.

As usual, I recommend getting a copy of Visual Assist X. It’s faster than intellisense and offers a few extra features, you can ‘Peek’ functions which will almost instantly show you where in Engine code that function has been declared, and what default parameters it has. It also tells you what default parameters it has as you type.

Create new projects using each of the C++ templates (First person, twin stick, etc) and read the source code. Read the source code of other projects as well, and if you don’t understand what certain lines are doing, ask a question on IRC or post on the forums. The API reference is only one piece of the puzzle.

Unreal Engine has great documentation. Sure it’s not perfect. There is a saying about open source documentation; it sucks. UE4 is not quite the same, but you’re getting all of this for free. If you think this documentation is bad, checkout CryEngine, you’ll cry yourself to sleep.

This. You won’t even need to open documentation that often as you can always get hands-on to the exact implementation of a function or a class you’re interested in.

Alt+G is my spirit animal :smiley: