I’m trying to write an editor utility script that will allow me to right-click on a ton of actors and set the max draw distance on all their child static meshes. I’m been fumbling around trying to find answers for a while now but not come up with anything that helps me.The attached images show the example of the static meshes I want to be able to get at, and the simplest (and most failed) version of the editor script where I get stuck. I can get the selected assets, and with a log print, I can see they are blueprints. But I can’t connect “get components by class” to the for each loop. So how do I get those child static meshes in order to be able to edit their properties?
I had tried this before but it fails at the cast - if you add a ‘log string’ to the ‘cast failed’ output, it always logs that string, indicating it’s always failing to cast the actor as an actor (?)
Right, but it’s an Object, not an actor.
Not sure what the problem is then
Are you doing this with assets in the content browser, or actors in the level?
Assets in the content browser. Sorry - should have made that clear. What I want to do is be able to select ‘n’ actors in the content browser and change all their child static mesh max draw distances in one go.
ie. select the assets in the asset browser → right click → scripted assets actions → [my editor utility script]
Ok, so it won’t cast to actor, because it’s not an actor
If you change draw distances in the content browser assets, it will affect all actors made from this asset next time you use it. Is that what you mean?
Yep - that’s what I want
Ideally I thought I could change max draw distance directly on the static mesh but that parameter only shows up once it’s a child of an actor blueprint. Still relatively new to a lot of this so I’m fumbling around a little.
It’s a bit of a strange way to do it, to make permanent changes like this. Especially as it won’t affect any levels already made.
What would make sense, would be to get the blueprint change the draw distance in the construction script when you dragged it into the world, based on a parameter.
So I have (in this case) a bunch of buses in a level, all created by dragging their actor blueprints into the level and positioning them. By changing the max draw distance on the static mesh in that actor blueprint, all the buses in the scene get affected. Now multiply that up by ‘n’ other objects that I want / need to cull based on very specific ranges. Hopefully that helps understand why I want to do it this way.
Also I can’t afford to go back through many hundreds (possibly thousands) of actor blueprints, change their construction scripts and re-place all those items into the level.
In other words, by mass-editing all the blueprint actors in the asset browser, every bus in the level will all be affected at once.
If you change the bus bp to that the draw distance is a parameter it will settable on all busses in the level in one go.
Oooooh wait - ok yeah I think I get what you’re saying now.
But that still needs me to add the parameter and construction script to each actor blueprint.
Let me see how hard this is (for me as a relative newbie).
Also, if you get your head around blueprint inheritance, you can just make ONE BP which knows how to set all its meshes draw distances, then make sure all your other blueprints inherit from that one.
If the concept behind all the BPs is similar ( they are all blueprints containing meshes ), this is quite easy.
That’s all level actors in one go, ever
Even if you’ve already made all the blueprints, you can reparent them pretty easily.
Ok this works great - I can throw in a variable / parameter too.
For the sake of argument - IS there a way to do what I originally asked with an editor utility script? I’m sure there must be - I’d like to get that under my belt too so I can refer back to it.
I’m going to have to learn about BP inheritance too for sure.
If you put that in a blueprint, on it own, call it ‘MasterBP’, for example.
Then go to one of your other BPs, and change the parent class to MasterBP, you will be able to this for all instances of that BP, also
As for your utility, I don’t know. As usual, there is no documentation. I got as far as this
But can’t find the components…
Thanks for that. I’ll go have another look when I’m back in the office on tuesday
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.