Creating Custom Snapping In-Editor Help

Hi there!

I’m a new user to UE4 and currently learning the ropes of UE4’s workflow. I’m having trouble trying to find a way to detect when actor property changes start/stop (or even more simply when the mouse button is let go, signifying editing may have stopped). My scenario is thus:

I created a custom Actor class (HexActor). I want this actor to snap to a hexagonal grid when you drag it inside the editor for ease of manipulation.

My first attempt was to use these events:

virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
virtual void PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) override;

To detect when the transform was edited. This only kind of worked. When the user drags the actor in the viewport none of these events fire, but if you manually edit they do.

My second attempt was to use a construction script. This fires every time the transform changes, but getting “snapping” to work from this context seems impractical since you can’t really tell if this is the start or end of a drag/rotation/scale. This will fire on the tiniest changes, so it’ll just snap back to the origin hex.

Should I be looking elsewhere in respect to modifying actor locations after user interaction? Any info or pointers to related documentation would be much appreciated, thanks!

Ah, the method I was looking for appears to have been AActor::PostEditMove()

Thanks for the tip: