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"

Adding an ArrowComponent

Hi!

I am in trouble trying to add an ArrowComponent to an actor. Maybe I'm missunderstanding what arrowcomponent means, but what I want is to show arrows like the editor shows when an actor is selected for move it.

In my .h file I defined it as follows:

 UPROPERTY()
 UArrowComponent * flecha;

And the inicialization in the constructor:

  flecha = CreateDefaultSubobject<UArrowComponent>(TEXT("flecha"));

But when I spawn the object, the arrow is not added to the scene. What is wrong in my code?

Thank you!

Product Version: UE 4.9
Tags:
more ▼

asked Apr 09 '16 at 06:12 PM in C++ Programming

avatar image

Gastón Giménez
38 8 11 11

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

1 answer: sort voted first

At a glance you need to use something like this:

   UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
   class UArrowComponent* flecha;

 flecha = ObjectInitializer.CreateDefaultSubobject<UArrowComponent>(this, TEXT("flecha"));
more ▼

answered Apr 09 '16 at 06:52 PM

avatar image

devlyn811
349 21 18 35

avatar image devlyn811 Apr 09 '16 at 06:58 PM

sorry about the spamming, I couldn't for the life of me get any of the code formatting to work!

avatar image Gastón Giménez Apr 09 '16 at 07:51 PM

Thank you! I tried this code but the arrow is still not visible. This actor I'm spawning has a lightcomponent too, in the following screenshot you can see that the light is showed in the scene but not the arrow: alt text

avatar image devlyn811 Apr 09 '16 at 08:46 PM

try adding after creating the arrow component and see if that gets it to show:

   flecha->AttachParent = RootComponent;
avatar image devlyn811 Apr 09 '16 at 08:39 PM

Is the arrow component variable visible in the blueprint components section of the blueprint editor? If so in the Details panel of the editor, when you select your actor placed in the level, is the arrow component variable visible there?

avatar image Gastón Giménez Apr 09 '16 at 08:49 PM

Thank you again for the fast answer. I was spawning the actor via blueprint at runtime and couldn't see the arrow. Now I tried spawning it in editor and the arrow appears. But the problem is that even in this case the arrow is not appearing at runtime, and I want to have this arrow to move the actor at runtime, in the same way we can do this in the editor. Is there some way to do this?

avatar image devlyn811 Apr 09 '16 at 09:06 PM

As far as having the arrow act as a click-drag gizmo in game, that would require quite a bit more work.

avatar image devlyn811 Apr 09 '16 at 09:04 PM

Can you double check its Visiblity (for the editor) and Hidden In Game?

Try:

   flecha->SetHiddenInGame(false);
avatar image Gastón Giménez Apr 09 '16 at 09:34 PM

Problem solved with this line! Thank you very much for your time!

(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