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"

Cast to component of an actor

Hi!

Really stuck with this; I would need to to cast to a non-scene component of a static mesh actor (that would then change the material listed under the component). I have managed to get the 2nd part working but the issues is in being able to cast anything to the component of the actor in the first place. I have tried several different methods but the cast always fails. With actors, I have managed to solve this sort of thing with 'get all actors of class' but I can't use any 'gets' with components.

Help is surely appreciated! alt text

Product Version: UE 4.21
Tags:
ueproblem.jpg (499.4 kB)
more ▼

asked Dec 14 '18 at 02:52 PM in Blueprint Scripting

avatar image

TheoT
38 6 7 10

avatar image Tuerer Dec 14 '18 at 03:12 PM

Cast to the actor and then just "Get" the component you need by its name.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

This pretty much all you need: Once you have a reference to the actor with the component you want use "Get Component by Class"

It's already correctly cast-typed so if the actor has the component it'll just work.

alt text

captura.png (22.2 kB)
more ▼

answered Dec 15 '18 at 03:34 PM

avatar image

Evigmae
1.4k 6 3 7

(comments are locked)
10|2000 characters needed characters left
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