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"

child actor component にセットしたアクターへのcast方法

予めchild actor componentを追加していた場合は問題なくcastができるのですが、
BP内でadd child actor component関数で作成したものに対してcastが出来ず困っています。


ビールケースはInt変数「NUM」の数だけ所定のロケーションにchild actor componentを生成し、
それぞれにset child actor class関数でビール瓶のアクタークラスをセットします。



Product Version: UE 4.20
more ▼

asked Nov 29 '18 at 02:03 AM in Blueprint Scripting

avatar image

3 1 2

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

1 answer: sort voted first

I think what your looking to do is this : alt text

You grab a reference of the child actor > Get child Actor > Then cast to the child actor, as shown above. As you can see i was able to get that "NUM" int you were talking about and also Call it's function to set the int. You could also use "Interface's" Well I hope this helps. :)

Here's what i said above:

子アクターの参照を取得します>子アクターを取得>次に、上記のように子アクターにキャストします。ご覧のとおり、私はあなたが話していた "NUM" intを取得することができましたし、intを設定する関数を呼び出すこともできます。あなたはまた "Interface"を使うこともできます。

I hope what i said is well translated, as i dont speak Japanese, so if it said something inappropriate blame google :) がんばろう

more ▼

answered Dec 01 '18 at 12:25 AM

avatar image

56 2 5

avatar image Acieh3 Dec 02 '18 at 12:17 AM

Actually I was need to know about this situation:
(1)Add new "child actor component" to the actor somewhere in blueprint by using "Add Child Actor Component" function.
(2)Then set other actor to the component by using "Set Child Actor Class".
(3)Then use "cast to (the actor object)".

In above situation, I saw an error at the "cast to" node before.
However, I reproduce that situation into new actor to visual explain and I cannot see any error there now.
I don't know why.
alt text

Anyway, thank you for your reply and I apologize my bad English.

cast-to-wtf.png (304.9 kB)
avatar image porckchop Dec 02 '18 at 02:12 AM

Cool! And your English is just fine :) Well the example i gave you actually worked when i tested it as far as casting, I see that your casting as pure And pure ive found works when your only getting a reference to a variable that isnt going to be modified at runtime ect., If you use a regualr cast all should be well. Im using version 4.21 of the engine. I personally prefer using Interfaces whenever possible. Well if i can help you with anything dont hesitate to ask. Friend and Good Luck!

(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