Announcement

Collapse
No announcement yet.

Python: Reference a C++ Class

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Python: Reference a C++ Class

    Hi all,
    I'm trying to spawn a C++ class that derives from Actor.

    How can I get a reference to my C++ class, so that I can pass it to spawn_actor?
    I've been using unreal.EditorAssetLibrary.load_blueprint_class, but obviously that isn't appropriate for C++ classes.

    The closest thing I've found is unreal.load_class, but that requires that you pass the class's outer... And I don't THINK that uninstanciated classes have an outer... or do they?

    Thanks in advance,
    Jasper

    #2
    If the class is exposed to scripting, then it should just exist in the unreal namespace already, eg) unreal.MyClass

    If it isn't exposed to scripting then you can probably get it by name, eg) unreal.load_class(None, "/Script/YourModuleName.MyClass")

    Comment


      #3
      Hi Jamie,
      Thanks for your answers, both working perfectly.

      I'm surprised I didn't think of the first one, and I could have sworn I'd tried your second method with None as the outer... I guess not.

      Thanks again,
      Jasper

      Comment

      Working...
      X