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"

Spawn specific actor in class

I am extremely new to UE4, and I have a question. I have a gun that shoots projectiles, and there are two kinds of projectiles. They both belong to the same class (Projectile) but are different actors. I cannot figure out how to switch between them. Here is a bit of my code:

//Header

 /** Projectile class to spawn */
 UPROPERTY(EditDefaultsOnly, Category=Projectile)
 TSubclassOf<class AMageDeflectionProjectile> ProjectileClass;

//.cpp file

     World->SpawnActor<AMageDeflectionProjectile>(ProjectileClass, SpawnLocation, SpawnRotation, ActorSpawnParams);

This code is from the pre-made 1st person shooter code, and the sample projectile actor is always the default one, and I am unsure how to switch it to a different one if desired.

Product Version: UE 4.19
Tags:
more ▼

asked Jul 18 '18 at 04:42 AM in Using UE4

avatar image

Impstar4
21 1 3 6

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

1 answer: sort voted first

And I was able to answer my own question in record time. I'll leave this up though in case other people run into the same issue.

I had to go into the Blueprint of the character, scroll down to where it allowed me to set the Projectile, and click on the drop down menu and set the actor I want there.

more ▼

answered Jul 18 '18 at 04:46 AM

avatar image

Impstar4
21 1 3 6

(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