Is it possible to execute Construction script once?

TLDR: I need to place EditableObject (new class i created) instead of static meshes so i can modify them !

I’m using UE4 for an architectural project. The goal is to import a house, and to be able to walk and change materials.
To do that, i made a class for the editable objects, it contains the static mesh and some variables.
Once i have the house imported, i choose the object that i want to be editable, right click on it and chose REPLACE WITH EditableObject (my class) ! Then in the properties of this new editable object i just created, i assign the static mesh that i have been deleted from the map. And it works !!

My problem is … that it’s ok to do that for 1 or 2 objects, but when you have to do all the walls, and all the parts of every piece of furniture … it’s just impossible ! So i want to find a way to select all my Objects and convert them to EditableObject by one click , i would hit Replace with, and it would assign the right static mesh for me.

I was able to find a way to do that, by assigning the Static Mesh in the construction script, and it worked, i was able to select multiple object, and hit Replace with, and i had the correct meshes at the right place.
The problem is … once i wanted to change any property of those objects, they disappeared.

So now i want to know if it’s possible to prevent the construction script to fire up when a change is made !
Or there any other solution to convert my meshes to EditableObjects very quickly.

Make one blueprint actor which we can call the ‘theme controller’. All it contains is an integer, which denotes the theme to use.

Then in your building actor class, you have a run in editor event like this:

Meshes and materials are just arrays of meshes and materials ( of course ). This way, you just set the theme in one place, then select all the actors on press the ‘read theme’ button once.

300180-changes.gif

You can do it so that they will find the controller and you can just press a button on the controller to send out a new theme, but the game needs to be running for that.

  1. For Event Construction, you can use a Branch and for boolean make it Editable with Default value False.no connect your construction code to the True part. whenever you need to use construction just change it to true for your actor(you can select wall together and change it at once
  2. for your Switch Problem you can use “all actor of class” and then for each loop and change them without problem
  3. or use instance static mesh or hierarchical instance static mesh(hierarchical is better performance but if they frame rate come below 10 it hides instances otherwise it’s better than another way)

Yes, handy eh? :slight_smile:

Thanks for your effort :slight_smile: To be honest, that didn’t help me, but i was able to figure out how to solve my problem with that Custom event you made ! I never saw a custom event that makes a button in the editor, so made a search and i discovered that if you check CALL IN EDITOR on the custom event, it will create a button that will act out of the runtime, which is exactly what i wanted :slight_smile: I was able to do everything i wanted, that the construction script won’t le me do :slight_smile: So thank you

2 Likes