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"

What is the modify() function ?


The short question is the title :-)

But here is the context, in case it's relevant.

I just spent about a whole day on the following problem:

When a rider dismounts its horse, i detach its rootComponent from a horse's socket using GetRootComponent()->DetachFromComponent.

It works well on the server, but when i connect a clientafter the pawn has been detached, the pawn is spawned at the origin instead of its server-location on the connected client.

Now in the FDetachmentTransformRules, there is a boolean bInCallModify which is set by default to true.

When i set it to false, it works well. It took me 15 hours to find that by random trials/errors, so i'd like to understand what's going on here.

This bool seems to force the call to a Modify() function.

But i can't understand what this function is doing. The comment in the header says:

  * Note that the object will be modified.  If we are currently recording into the 
  * transaction buffer (undo/redo), save a copy of this object into the buffer and 
  * marks the package as needing to be saved.
  * @param    bAlwaysMarkDirty    if true, marks the package dirty even if we aren't
  *                                currently recording an active undo/redo transaction
  * @return true if the object was saved to the transaction buffer
 virtual bool Modify( bool bAlwaysMarkDirty=true );

But i don't know what this means.

So basically, when an actor is modified (which is the default, so maybe it's important ?), it spawns at the origin on connecting clients, and when not, it spawns correctly.

Anyone care to explain (simply please) ?

Thanks !


Product Version: UE 4.19
more ▼

asked Apr 29 '18 at 05:34 AM in C++ Programming

avatar image

860 75 93 362

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

1 answer: sort voted first

Hmmm, unfortunately, after more testing (takes time because i have to repackage each time for steam to work), it still doesn't work, so Modify() isn't the solution.

I'm still curious about what it means tho, because i use a lot of attach/detach.


more ▼

answered Apr 29 '18 at 07:07 AM

avatar image

860 75 93 362

avatar image Doublezer0 Nov 25 '18 at 03:23 AM

Modify stores a snapshot of the Object into the transaction for undo/redo purposes. I believe it will only work if the Object has the flag RF_Transactional.

(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