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"

Why are all casts but one failing?

alt text Casting to MyPiece1 never fails, but will always fail when casting to other actors of the same class (like MyPiece2 and MyPiece3 shown).

Product Version: UE 4.18
capture.png (177.1 kB)
more ▼

asked Apr 04 '19 at 04:25 AM in Using UE4

avatar image

Hoopy Fr00d
1 1 1

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

1 answer: sort voted first

You're casting the same thing every time ( the same array element ), it can only be one type of thing. So the first cast works ( because it is of type MyPiece1 ), but the others fail.

What are you trying to do?

( For this to work, you would need the 'MyPiece's to be sub classes of each other... )

more ▼

answered Apr 04 '19 at 07:19 AM

avatar image

220 3 4 4

avatar image Nebula Games Inc Apr 04 '19 at 02:55 PM

Agreed, index "0" must be the correct type while the other ones aren't. And you are as mentioned above only ever using the first array index. For help with casting and creating references check out video #1 and #25. Should point you in the right direction with this and how to properly cast/reference these actors.


avatar image Hoopy Fr00d Apr 05 '19 at 01:42 AM

Thank you, the indexes were the problem :)

(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