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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to a delete a component of another actor, but they're the same type of actor?

So i have an actor i want to spawn multiple of but each time I spawn a new one I want a component of an old one to be destroyed. I've tried making an array and calling a function and print debug shows the code is ran but the part isn't deleted. Here's an image before I made the array.alt text

Product Version: UE 4.17
im-lost.png (361.6 kB)
more ▼

asked May 15 '19 at 03:33 AM in Blueprint Scripting

avatar image

HP Laserjet 400
1 1 1

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

2 answers: sort voted first

Right now you have the Port component of the brand new spawned actor being called to be destroyed rather than from an old actor. You would need to get a reference to the old actor you want to destroy it on.

more ▼

answered May 15 '19 at 04:36 AM

avatar image

95 8 9 12

avatar image HP Laserjet 400 May 15 '19 at 05:50 AM

ah I worded it wrong. I destroy components of both actors as I spawn them and the old ones have no problem but the new component should have the Port component destroyed but it cant be destroyed by another components blueprint

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

You can create your own function in the component-owning blueprint which will destroy a component (you can pass the component in as a parameter if you wish). That function would call "Destroy Component", while you would call "MyDestroyComponentFunction" instead.

Note that the component does still need to be owned by the actor you call the DestroyComponent function within.

more ▼

answered May 15 '19 at 09:00 AM

avatar image

441 2 5 7

avatar image HP Laserjet 400 May 15 '19 at 11:53 PM

Here is with the function I created and set the new actor as the target but still nothing happens. All the print debug text shows that the code is running.alt text

avatar image Unfathomable May 16 '19 at 06:44 AM

The issue with the implementation is that you are populating the Demo Parts array in the current actor, not the one you are spawning. Drag off your newly spawned actor and set the Demo Parts array on it instead.

avatar image HP Laserjet 400 May 16 '19 at 07:57 PM

Thank you for the help! that did the trick. here's the Bp that works for anyone else having this issue.alt text

working.png (348.4 kB)
(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