x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Is it possible to cast Actor to Bueprint Actor in C++ and return it to Blueprint?

For example I have C++ class AMyGameMode, which is inherited from AGameMode, and MyGameModeBlueprint which is inherited from AMyGameMode. The project is setup as having MyGameModeBlueprint as Engines GameMode class.

Can I write UFUNCTION which will return World->GetGameMode() object, which will be interpreted as MyGameModeBlueprint type object in blueprints, without any subsequent casts in blueprints, and without using blueprint macros.

Product Version: UE 4.9
Tags:
more ▼

asked Sep 21 '15 at 08:11 AM in C++ Programming

avatar image

Yata
544 39 50 69

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

No, because blueprints don't exist physicly as C++ code, so it does not exist during compilation code in order to link it sonehow. You would need to make custom UK2Node class for that, which would auto cast the output pin (Same as curently Spawn Actor node doing, which is also custom K2Node).

You may heard about this, theres currently experiments in Epic, to make blueprint compile to C++ code, this may allow easier access to blueprint classes in C++, which could let create such a node, with standard function bind.

more ▼

answered Sep 21 '15 at 12:25 PM

avatar image

Shadowriver
37.1k 935 172 1116

avatar image Yata Sep 21 '15 at 03:52 PM

Wow, sounds cool but to complex for my task. I will research in custom UK2Node creation, but definitely would not use it in my project. Thanks man.

Blueprint to C++ is cool, but I think some form of declaration that this function actually return BlueprintDerivedClass, not this CppBaseClass, would be enough for my task.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question