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 components to Shooter Game Sample actors?

I've been tasked with adding an ability into the Shooter Game Sample system.

I've written up the ability, tested it in a first person environment, and verified it works great. ...Unfortunately, I wrote it so that the input component is dependent on the player pawn.

I'm trying to attach this actor component file to the player pawn in the Shooter Game Sample and can't seem to edit/gain access to the player pawn being used. All of the guides and tutorials I've found have suggested selecting the player pawn in-use and converting it to a new BP, but that results in Unreal crashing to desktop.

Does anyone have a suggestion on how I can work around this?

Thank you!

Product Version: UE 4.20
Tags:
more ▼

asked Nov 26 '18 at 04:33 AM in C++ Programming

avatar image

mrussell1986
3 1 2

avatar image Shadowriver Nov 26 '18 at 05:25 PM

What do you mean "gain access" also can you provide logs from Saved/Logs after crash?

avatar image mrussell1986 Nov 26 '18 at 06:51 PM

I'm launching the First Person Shooter sample game in UE4.20.3. I've coded up an Actor Component that I want to attach to the PlayerPawn. When I view the PlayerPawn blueprint from the content browser, it's empty.

alt text

When I try to find the actor in runtime and create a new blueprint from it, Unreal crashes to the desktop.

alt text

  • Launch the game.

  • Press "compile".

  • Press "play".

  • Press Shift + F1 to get control of the mouse.

  • Select "PlayerPawn" from the world view.

  • Click "Blueprint" from the toolbar.

  • Click "Convert Actor to Blueprint".

  • Observe the crash to desktop.

link text

crash-log.txt (122.2 kB)
player-pawn.jpg (28.5 kB)
(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I managed to solve my original problem. I was able to add the C++ Actor Component I created to the existing Shooter Game PlayerPawn by adding a component object directly to the ShooterPlayerCharacter.cpp file.

 AShooterCharacter::AShooterCharacter(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer.SetDefaultSubobjectClass<UShooterCharacterMovement>(ACharacter::CharacterMovementComponentName))
 {
     Mesh1P = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("PawnMesh1P"));
     Mesh1P->SetupAttachment(GetCapsuleComponent());
     Mesh1P->bOnlyOwnerSee = true;
     Mesh1P->bOwnerNoSee = false;
 
     MyAbility = ObjectInitializer.CreateDefaultSubobject<UShooterMyAbility>(this, TEXT("My New Ability"));
 }

When I run the game in the editor, I can now select the PlayerPawn and see the desired component attached.

The crash still occurs when I try to convert the PlayerPawn actor to a Blueprint but such is life.

more ▼

answered Nov 30 '18 at 01:44 AM

avatar image

mrussell1986
3 1 2

(comments are locked)
10|2000 characters needed characters left
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