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 an Actor using a widget button

Hello. I want to spawn an actor using a widget button. I have found a document that let's you spawn actors by pushing a specific key (done on level blueprint) but what I need is to spawn an actor on a target by pressing a widget button. I tried to Implement what I did on the level blueprint to a widget I created but nothing happens

Product Version: UE 4.12
Tags:
simplespawn.jpg (63.2 kB)
widgetspawn.jpg (110.1 kB)
more ▼

asked Jun 24 '17 at 05:15 PM in Blueprint Scripting

avatar image

fajelarodel
3 2 3

avatar image fajelarodel Jun 24 '17 at 05:21 PM

I also need that Actor to be invisible before I click the button because currently It is already visible and placed inside the game when I press play. Thank you in advance

avatar image MatzeOGH Jun 24 '17 at 05:49 PM

You are probably not defining the class to spawn. How are you setting the reference for the piece and target variable?

avatar image fajelarodel Jun 25 '17 at 05:58 AM

I create a variable and then on the variable type I find and select the Piece and the Target

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Here is a very quick Tutorial: alt text

in Your Widget BluePrint

  • add "get all Actors with tag" , on tag name enter "SpawnHere"

  • make a "for each Loop" out of "get all actors" node

  • "get location" of forEachLoop's "Array Element"

  • add a "Spawn actor" node and connect it to "ForEachLoop"

  • connect "get actor Location" to "Spawn Transform"

in your Level:

  • add a "Target Point" actor

  • search for word "tag" in in target point properties, Actor Tag will show up

  • add a new tag and enter "SpawnHere"

now when you run the game, as soon as you pres the button in your widget a new actor will spawn at the location of this target point. you can copy this target point to multiple location and it will spawn a new actor in each of those locations.

spawn.jpg (85.4 kB)
more ▼

answered Jun 25 '17 at 08:37 PM

avatar image

m-motion
16 3 4 9

(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