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"

How do I Spawn an Actor from a custom Editor Window?

I am attempting to Spawn an actor, but all the previous methods use GetWorld()->SpawnActor. However, from a custom SWidget inheriting from SCompoundWidget, I do not have direct access to the world. If anyone knows the best way to spawn an Actor from a custom widget, that would be awesome!

Product Version: UE 4.21
more ▼

asked Feb 26 '19 at 10:37 PM in C++ Programming

avatar image

1 2 4

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

1 answer: sort voted first

What is your Custom Editor Window? Is it a custom UE4 editor window? Or an in-game-editor window? Not really clear.

Since your talking about widgets, I will assume it's the later. In this case, you want the widget to fire off an event in the level blueprint. For this, you will need an event dispatcher.

In the widget you add an event dispatcher, and in the level blueprint you bind an event to that dispatcher.

Check out this vid: https://www.youtube.com/watch?v=9uweDnKGbG8

more ▼

answered Feb 26 '19 at 11:07 PM

avatar image

181 3 3 10

avatar image alsanoja Feb 27 '19 at 02:32 AM

It is not in-game. It is a UE4 editor window that I wish to be able to spawn an actor upon a button press into the non-running simulation. Unfortunately the video doesn't really apply in that case, but I appreciate it nonetheless.

avatar image Doctor_Kannon Feb 27 '19 at 08:36 PM

Ok. That's more clear, It also seems like your focus is on C++ dev.

From the editor, you can drag-and-drop actors into the editor scene. But there is no button to do so.

And as far as a custom editor window, I'm not aware of anyone focused on that sort of development. AFAIK, Epic has not released the editor source code.

Also, when you say 'non-running simulation', you mean the scene in the editor?

avatar image alsanoja Feb 27 '19 at 09:37 PM

Exactly! Basically I want that same drag and drop functionality, but on a button with a specific actor. I've been hunting through the source code to find out how that is done in c++ code within the engine.

avatar image Doctor_Kannon Feb 28 '19 at 12:33 AM

What you want is a feature for the editor.

The game engine and the editor do not share the same code. We have access to the engine code and use it make games. We do not have access to the editor code which provides us with the windows and blueprints.

avatar image alsanoja Feb 28 '19 at 01:20 AM

So then Spawning something into the scene cannot be built into an editor plugin? It seems like one can grab all of the actors in a scene and modify them, as shown in the extending the editor video here https://www.youtube.com/watch?v=zg_VstBxDi8, and thanks for all of the insight!

avatar image Doctor_Kannon Feb 28 '19 at 08:00 PM

There you go. I stand corrected.

So, yes, you can. The button is will need to reference an actor. That might be very complicated. I would start small, like a button that just adds a cube.

(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