Ryan DowlingSoka Profile picture
Technical Art Engineer @ Odyssey Interactive https://t.co/c6yzxFdYQN I'm not on here https://t.co/wn2Flpl0rb

Nov 8, 2022, 5 tweets

#UE5 #UnrealEngine

When working with editor utilities sometimes you need an object type that isn't a "BlueprintType". This makes your life hard, because you can't cast to it.

Don't fear: Create an ExecutePythonScript node with an input and an output and link em.

In the above example, UFactory is not a blueprint type, so we can only construct it as a UObject. Then we can't cast it regularly, so we use the ExecutePythonScript to skip past that issue and plug it into CreateAsset which wants a factory directly.

Just to make sure it's clear. You only have access to the ExecutePythonScript in EditorUtilityWidgets and EditorUtilityObjects, it won't work at runtime, and you shouldn't want it to.

If you want this to work like an actual cast, and not just crash when the cast fails:

Addendum in the CreateAsset case, there are other ways around this that don't feel like you are committing crimes:



The need for such a cast still likely exists in other places, but maybe not this one.

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling