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"

Is there a way to call a function when an actor is placed in the editor?

Hello, i have a small problem with placing actors in the editor and getting a function called on them. What i want is that when the actor is dragged out from the content browser and then placed in the world a function should be called to set some default values.

From what i have tested i can probably get the OnConstruction() function to do what i want. I have the function set up like this.

 void APhysicsActor::OnConstruction(const FTransform& Transform)
     if (!HasDoneFirstConstruct && GetWorld()->WorldType == EWorldType::Editor)
         UE_LOG(LGeneral, Warning, TEXT("OnConstruction: %s, %s"), *GetName(), *Transform.ToString());
         HasDoneFirstConstruct = true;

What happens with this function is that the function is called twice, once when the actor is dragged into the editor viewport and then once more when the mouse is released and the actor is placed into the world. Is there some way to fix so that it is only called once, when the actor is placed in the world?

Or is there some other way to achieve the results i want?


Product Version: UE 4.15
more ▼

asked Aug 10 '17 at 10:30 AM in C++ Programming

avatar image

200 54 54 64

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

0 answers: sort voted first
Be the first one to answer this question
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