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"

Cast AActor to empty(none) error


I have a inventory class that is derived by a empty class(none) and a AActor that inherits from this class. But I want to cast from the actor to the inventory and I get compile errors like this: no sutable constructor exists from AActor to Inventory.

Maybe I'm casting wrong or I'm using the wrong function but I can't figure out the solution, thought I hope someone can help.

Here is the source code:


The normal Cast doesn't compile too:


Could It be that UE doesn't support this option and I need to write my one cast function, but I don't know how it works so I hope that someone shows me the right path.

Thanks a lot for every help and if my question was unclear or I didn't provided enough information feel free to ask : )

Product Version: UE 4.16
more ▼

asked Jul 01 '17 at 04:45 PM in C++ Programming

avatar image

125 13 16 24

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

1 answer: sort voted first

UE4 is not supporting multiple inheritance. yes - it is very annoying, but we have to deal with that.

You can get around it using Interfaces, or components.

more ▼

answered Jul 01 '17 at 05:19 PM

avatar image

919 21 46 64

avatar image 143258 Jul 01 '17 at 05:21 PM

Thanks, but how does it works with components do you mean a actor as a component?

avatar image Arty-McLabin Jul 01 '17 at 07:01 PM

if you write ur custom component class, you can later add it to the actor, and use that component methods and data for ur logics.

for example instead classic C++ scenario:

 class WheeledAircraft : public Aircraft, public Wheeled;

you would do

 class WheeledAircraft : public Aircraft{
        MyWheelComponent* wheels;

notice! the last example is for logics, i don't exactly remember how to add components via C++, it is a bit annoying syntax, so a bit of google on that will let you go.

good luck :)

avatar image 143258 Jul 01 '17 at 07:08 PM

Thanks, I understand it now

avatar image Arty-McLabin Jul 03 '17 at 01:57 PM

no problem :)

tell me if you have some problems with it, it is a very complex field and has almost no support / tutorials on it. i've gone trough some of that shit so i will be more than happy to lend a hand.

(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