Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: szomaza on December 27, 2018, 02:05:41 PM

Title: Destroy Component action throws an error
Post by: szomaza on December 27, 2018, 02:05:41 PM
Destroy Component action throws an error and stops game when the component that should be destroyed in not there.

LogError("No such component: " + component.Value);

This is not a bug, just how the action is written.

But why is it written like this?
Wouldn't it be better if it just continued without a problem when there is nothing to destroy?
That is what I was expecting.

Of course there is a solution: you can use Has Component action to make sure the component is there and only then destroy if it is found, but this way you need 2 actions to achieve the same thing.
Am I right, or what am I missing here?

Br,
szomaza
Title: Re: Destroy Component action throws an error
Post by: Alex Chouls on December 29, 2018, 02:32:26 AM
You're right the action could be more forgiving.
I'll update it in the next release.

For now, you could comment out the LogError line:
Code: [Select]
//LogError("No such component: " + component.Value);
I'll probably make it an option (e.g., a Log Error check box) since sometimes it's good to know if it fails when you expect it to work.
Title: Re: Destroy Component action throws an error
Post by: szomaza on December 29, 2018, 03:06:47 AM
Thank you very much for the quick solution for now!
I am learning to be braver editing the scripts with every issue found. Great!

And +1 for leaving the option there.

Thanks!