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 static mesh by UMG button

hi there! i want to create a button in my widget, to destroy and spawn a cube static mesh. (example name "CubeA") i want to make this with a checkbox. the checked button destroy the CubeA, and when the user unchecked it, it spawns.

the first part is allready done. the cheked button destroy the CubeA. but how can i spawn it back?

Product Version: UE 4.9
Tags:
more ▼

asked Sep 29 '15 at 07:06 PM in Blueprint Scripting

avatar image

lobaanicht
17 3 5 10

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

1 answer: sort voted first

Hey lobaanicht-

You can set an OnClicked event for the button that, when pressed, calls the SpawnAcotrFromClass node to spawn an actor from the appropriate class.

Cheers

Doug Wilson

more ▼

answered Sep 29 '15 at 07:34 PM

avatar image lobaanicht Sep 29 '15 at 08:44 PM

hi Doug, thanks for your answer! unreal engine is new for me. can you explain your answer a little more? when i use spawn actor from class, no static mesh appear. there must also be a function to set the location of the object.

avatar image Doug E ♦♦ STAFF Sep 29 '15 at 09:24 PM

When using Spawn Actor from class it will prompt you to choose which class to spawn an actor of. So the simplest solution would be to create an actor blueprint and give it a static mesh component set to the static mesh you want to spawn. Then in the SpawnActor node you would set the Class field to the blueprint. For the location you can pull off of the Spawn Transform pin of the spawn node and choose Make Transform. This will allow you to set the location, rotation, and scale of the actor when it is spawned.

(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