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"

Assign UStaticMesh to Root Component

Hey eveyone,

i've just started learning c++ coding in UE4 though i am not completely new to c++ in general, To start up i followed along the official tutorial series with the Battery Collector Example. The woman in the tutorial used UE v4.9. In the Constructor of the Pickup Class she does the following: RootComponent = PickupMesh;

I am getting the error, that it is not possible to assign an entity of UStaticMesh* to USceneComponent*. What do I have to do ? And furthermore would you guys suggest me to keep following this maybe "outdated" tutorial series ? Thanks for any help.

Product Version: UE 4.16
more ▼

asked May 27 '17 at 10:57 AM in C++ Programming

avatar image

15 3 4 7

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

1 answer: sort voted first

Hi Luuke it sounds like you grabbed the wrong Variable here. You want to use tha Variable that is a UStaticMeshComponent* (Thats the Component that is responsible to Render Meshes, it uses a UStaticMesh* via SetMesh(TheMesh)) and not UStaticMesh* (Thats your Model)

Its also Possible that they made a mistake in the Series that gets corrected in the next Episode.

But in general the Logic stays the same there maybe small changes here and there and you can find those changes very easy via the search or official Docs. Another thing to note is that the Tutorial is 7 Versions behind and every Version Comes with Pages long Changes that can in fact change a Function name or add/remove Parameters or even more dramatic Changes sometimes.


You can always look into the sourcecode or the Api to See what Functionality exists and what Parameters they take with a small description on the side. But usually the Function name already is self explaining. Here two examples.



Dont get overwhelmed by the amount of Functionality thats in there most of the time you use only a small Portion of them =) If you cant find your Function there its probably because its inherited from its Parent so you can look there.

(example hierarchy) https://gyazo.com/a8f36ee376ef685074232073a7c33719

And dont worry you will learn how to navigate and orient around the more you Code. If you can afford or want to do a 30day trial I can recommand you https://www.wholetomato.com/ that plugin is a powerhorse for Navigation and Codehints.

Good Luck mate =)

more ▼

answered May 27 '17 at 04:44 PM

avatar image

7k 143 28 172

avatar image Luuke May 29 '17 at 08:20 PM

Hey thanks very much for that detailed answer ! :) It definitely helped me getting further on this.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

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

Answers to this question