I want to add all the static meshes i have in the content browser to an array , and i don’t want to add them manually to a variable because there is a lot of them and i just can’t do it manually.
Also i can’t use the static mesh actors of the level (with GET ALL ACTORS OF CLASS) .
I really need to be able to use SET STATIC MESH with one of the meshes from content browser, just like if i had to select one from the list manually, but i want it automatically from the blueprint, and i can’t find a way to do it.
Searching object of asset using variues iterators that UE4 provides is indeed unreliable due to fact that asset need to be loaded in to memory in order to be visible as object. You need to access asset registry which is the thing that Content Browser actually displays, from there you can get asset from variues iterator and other function options.
You will get Asset Data contain asset information as well as Get Asset which will trigger asset to load
Here one warning, iterating huge amount of assets may take full seconds and it will freeze your game during this process (this includes editor it self, as game code is formally part of the engine and as that part of the editor too) as it will block ticking and rendering process. So do this only once (keep results in array) in moment that player don’t notice, ot iterate paths in more optimal way, in small only if needed where it is needed
Here extra documation about it but for C++ but oyu should get some information about asset registry, practicy you will be using same function in blueprints:
thanks for taking the time to answer i will have a look at that and try to find a solution with it
Hi, i’m trying those asset registry tools now, and i was wondering, how to use the asset as it is (as a static mesh here) ? I mean when i get the asset data, and then use GET ASSET , the return value is an OBJECT OBJECT REFERENCE, and i can’t use it with the SET STATIC MESH … is there a way to convert it or something like that ?
Once you use “Get Asset” the result needs to be passed through the node “Cast To Static Mesh”. Once that is done, you can pass it to “Set Static Mesh” to add the found component
This works on UE4 4.25, and I’m using it to get all static meshes from the Registry. I also apply a filter, to just get me static meshes.