Download

Actor properties set during the game, preserved in editor

The house actor what I’m working stores the furniture, doors, stairs, etc, in arrays. To fill the array, I place the staticmesh in the house, which is located at 0,0,0. Then I copy the location and rotation values from the staticmeshes to the house array slots. It’s very, very tedious.

There are some way to run the game, execute some function that fill the array by looking the static meshes in the house, and when return to the editor, the array values will be preserved? So I can store all as an archetype.

you cannot save stuff from the game back into the editor
however you can execute the function at editor time using the ancient and hidden trick of a custom brush :slight_smile:

I have a couple of these which I use for debugging my custom paths, snapping meshes, etc
here’s how it goes:


class myEditorTool extends BrushBuilder;

var() bool bSomething;
var() int SomeInt;

event bool Build()
{
 local WorldInfo WI;
 local Actor worldActor;
 local Vector newLoc;

 WI = class'Engine'.static.GetCurrentWorldInfo();

 foreach WI.AllActors(class'Actor', worldActor)
 {
  `log("hi this is "$worldActor);
  worldActor.SomeFunction();
  worldActor.SomeProperty = "blah";
 }

 return false;
}

defaultproperties
{
    BitmapFilename="DownArrowBlue" // Engine\EditorResources\wxRes\DownArrowBlue.png - will only accept png cursors from that folder
    ToolTip="My Editor Tool"
}

just by creating this class and compiling, a new button will appear in the editor on the left panel at the bottom of the brush tools.
left-clicking the button will execute the Build() function. keep in mind you can’t use anything that requires ticking (i.e. timers)
the editor-exposed bSomething / SomeInt variables will show up in a popup if you right-click the button. at that time changing any variable will run the Build() function

It works perfectly, just what I needed, thanks a lot!

glad it worked :slight_smile: