x

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"

Customize a Pawn Tutorial OurVisibleComponent Error

Hey there, I noticed that the tutorial for "Customize a Pawn" is made for Unreal Engine 4.9. I'm a bit new to the engine and I couldn't find an answer online.

The tutorial asks you to set OurVisibleComponent (A pointer to a USceneComponent) to a UStaticMeshComponent, which logically shouldn't happen at all.

Of course, Visual Studio picks up on this and instantly marks it as an error as well.alt text

I'm a bit unfamiliar with some UE4, so is there any form of code that I can write to fix this error? Thanks in advance!

Product Version: UE 4.16
Tags:
error.png (62.3 kB)
more ▼

asked Jul 19 '17 at 09:33 PM in C++ Programming

avatar image

RandomAnimeGamer
18 1 2 6

avatar image RandomAnimeGamer Jul 22 '17 at 04:27 AM

Okay, I hate to be a bother and I understand that this was posted only 2 days ago, but this is seriously annoying me.

Someone posted a question 10 hours ago and got an answer + comments within two hours of him posting, where I haven't gotten anything.

I mean, do you guys need more information or something? Is there possibly any misunderstanding going on? I can't do these things if nobody tells me what they need to help.

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

2 answers: sort voted first

Does it not compile? I tried that and it compiles fine for me. You can ignore the Intellisense errors if it compiles.

If it isn't compiling for you for some strange reason you could try declaring the "OurVisibleComponent" as a UStaticMeshComponent instead.

 UPROPERTY(EditAnywhere)
 UStaticMeshComponent* OurVisibleComponent;

Or you could try casting as suggested here: https://answers.unrealengine.com/questions/359380/cant-set-pointer-to-derived-type.html

more ▼

answered Jul 22 '17 at 08:14 AM

avatar image

Shogo999
245 10 5 14

avatar image RandomAnimeGamer Jul 22 '17 at 07:19 PM

Thanks for the answer! I'll try those once I get home from work. As far as I read from that link, it seems that implicit typecasting isn't really a thing with UProperties then.

So far, I'm thinking that the issue is likely solved by explicit typecasting, but I'll see for myself.

As a side-note, I asked a friend and he said to use Blueprints instead of C++, despite me saying I refused to use them. R.I.P. Proper Coding Practices.

avatar image RandomAnimeGamer Jul 25 '17 at 05:19 AM

Sorry for the late response, apparently it compiles fine with UE4. Maybe I should uninstall VS and reinstall the latest version.

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

I had to put #include "Components/StaticMeshComponent.h" in MyPawn.cpp. I think the problem is because with out the include StaticMeshComponent is treated as an incomplete type and it doesn't know how to implicitly cast it.

If anyone knows better I'd be interested to hear. I'm only guessing from a quick google and some testing in visual studio.

Edit: Clarity.

more ▼

answered Sep 14 '17 at 04:27 PM

avatar image

Magic Kiwi
6 2 3

(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