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!

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"));

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

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:

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?

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?

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

  flecha->AttachParent = RootComponent;

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

Try:

  flecha->SetHiddenInGame(false);

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

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