I want to get reference (or get full path) of an static mesh asset from “Static Mesh Actor” in a map.
We can see a magnifier icon in Detail Panel of “Static Mesh Actor” (in static mesh category) shown in below image
this is simply open containing folder of assigned static mesh!
The question is:
How to get address of assigned static mesh to an actor!
I search the internet and can not find any answer.
I try many solution,
Get Path Name: return “level asset” path so cannot be used as Asset Path of “Load Asset” function
for some person who may asked why do you need this, I explain the problem:
We want an script (or something similarily) to automatically copy assigned material from static mesh actor (in level) to StaticMesh (in game content)
As shown in upper image, Wall_008 (level asset) has an orange material and Content Asset (Static Mesh in Right of Image) has a white material.
Thank you in advance for any help
I dont know if I know exactly what you want.
But from what I guess you want, you could try something like this:
You might have to enable the editor scripting utilities plugin.
Obvioulsy the solution is not perfect, since I only get the first material from the array, but you can think of a logic to assign multiple materials by simply looping (or keeping track of the slot number in the first place).
First of All thank you for your answer, I really appreciate that.
But I want to Get All Actors and fetch reference to their asset, you get SELECTED ACTOR and then get SELECTED ASSETS!
In your solution the actor must be selected from level and also asset must be selected from content browser MANUALLY!
I want to do this automatically (not selecting Item manually)
by the way Thank you.
Then, instead of “Get all selected level actors” use the following node:
hey, did you find any solution?
The solution is to get the soft reference of the static mesh, load the asset and apply the material to it, then save the asset.