Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] Add components to an actor [C++]

Hi! I want to create a new actor and add some components to it, e.g. a StaticMeshComponent. However I can't find any working examples or documentation how to achieve this. Does anyone know how this can be done in C++ and not with the blueprints?

The background is that I'm about to model a grid based RTS navigation system and planing to implement actors that will represent units. The units would therefore need a representation in the world and some other custom logic.

Product Version: Not Selected
more ▼

asked Mar 26 '14 at 09:16 AM in C++ Programming

avatar image

853 125 112 138

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Jul 23 '14 at 12:53 PM by undercover for the following reason:

The question is answered, right answer was accepted

1 answer: sort voted first
more ▼

answered Mar 26 '14 at 09:25 AM

avatar image

10.6k 446 346 1088

avatar image undercover Mar 26 '14 at 09:57 AM

Thank you!

That worked great. I have some follow up questions though. Now I can see the model but I can't move it around in the editor. JoyfulControl->AttachParent = Mesh; didn't compile for me so I commented that out so maybe that's why or should you add a SceneComponent to the actor as a root component?

I typed static ConstructorHelpers::FObjectFinder StaticMeshOb_AW2(TEXT("StaticMesh'/Game/TestMdl'")); but why did the example type ..."/JoyControl_WindTurtle.JoyControl_WindTurtle" and not just "JoyControl_WindTurtle".

And finally what function does the name parameter have in CreateDefaultSubobject, must i be unique per world, actor or not at all?

avatar image Rama Mar 26 '14 at 10:03 AM

Try AttachParent = RootComponent;


to get the right reference, find the asset in the editor, and use right click Copy Reference

Sorry I cant answer all the questions right now.



PS: make a separate post for whatever you cant figure out on your own :)

avatar image undercover Mar 26 '14 at 10:09 AM

Okay, thanks a lot for the help!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question