Hi everyone, I had temporarily removed a folder containing static mesh assets from the project without deleting them from the level. This left the level with a bunch of “Static mesh actor has NULL StaticMesh property” errors obviously. However, I assumed upon re-adding the previous folder back into the project that all the Static Meshes would automatically be re-assigned (the same way other programs automatically find missing data when the data paths are restored). Unfortunately, that is NOT the case, and all the static mesh actors remain unassigned.
Is there a way to quickly re-assign ALL the missing static meshes based on the names of the Static Mesh actors in the level? If not, is there a Marketplace tool that does this? This seems like a real workflow problem if a folder gets moved or deleted and then has to be restored. Does one really need to go through every actor one by one and assign the missing Static Mesh manually? Thanks!
Look into Blueprint Utility actors, if you want to do this with Blueprints. You could also do C++ code that auto-executes on loading. But presumably, you have a way to automatically assign each SM to each SM_Actor (an algorithm basically). Otherwise, how does each actor know which SM to select?
No idea why answers have to await approval by a moderator, but maybe it has something to do with including several images? Hopefully the answer I posted will be approved soon.
Tried posting this answer yesterday but it got censored by overzealous word filters, so here it is again:
Success!! I want to thank the Lord Jesus Christ for guiding me to a solution! This method is a combination of useful info discovered online as well as a helpful tip from CodingRook. There are probably other ways of doing this, and presently this method requires running the script a few times (4 times in my case) until all NULL actors are replaced.
I had 745 NULL Static Mesh Actors, and this script assigned 222 missing static meshes at a time (not sure why it maxed out at that number, but perhaps it was due to multiple duplicate meshes being instances of each other). If someone knows how to do it in a single click, feel free to share, but for now, here is my solution:
Make sure “Editor Scripting Utilities” is enabled in Settings > Plugins.
Right-click in the content browser and select Editor Utilities > Editor Utility Blueprint
Choose ActorActionUtility as the Base Class.
Give the new blueprint a name such as “ActorUtility_AssignMissingMesh” and open it.
Since we only need the script options to show when we right click a Static Mesh Actor in the level or in the outliner, we can click Functions > Override > Get Supported Class and deleted the Parent Supported Class node. Then switch the Return Node to be Static Mesh Actor, as shown below:
(6) Create a new function and name it “Find NULL Static Meshes”. This is a debug function so you can test how many NULL Static Mesh Actors are in the level. Set up the graph as shown below:
(7) Now create another new function and name it “Replace NULL Static Meshes”. You can copy some of your code you used in the first function and setup this new function as shown below. This function will compare the name of each NULL Static Mesh Actors with the names of the Static Meshes in your project’s folders. If it finds a match, it will assign the mesh with the matching name. Right-click the image below and open in a new tab to see it better:
(8) Now compile and save your blueprint and right-click on a static mesh actor in your level or in the outliner. You will see a new menu option for Scripted Actions, and inside will be our 2 functions.
(9) Click on “Find NULL Static Meshes” to verify how many NULL Static Mesh actors are in your scene. Then click on “Replace NULL Static Meshes” to automatically assign the missing static meshes. The editor may pause for a moment while it does this. When Match Found? becomes FALSE, the script will stop and will tell you how many meshes were replaced. If this number is smaller than the number shown by the “Find NULL Static Meshes” script, then run the “Replace” script again until you have made all the replacements. As mentioned earlier, if someone knows how to make this work in a single click, feel free to share! I hope this info helps someone.
Further info on working with both Asset and Actor Utility blueprints can be found [HERE][4] and in the [UE4 MANUAL][5]:
Oh that’s strange, I can see the pics on my end-- perhaps the system glitched? I will try to edit the pics, hopefully it won’t get flagged for moderation again…