RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

TryFindComponentOnEntityContainerOrParent no fail please

Open IProduceWidgets opened this issue 1 year ago • 6 comments

TryFindComponentOnEntityContainerOrParent would fail trying to Resolve on parents that don't have the component its searching for. This prevents that by changing the Resolve to TryComp.

IProduceWidgets avatar Jul 29 '24 18:07 IProduceWidgets

Isn't the trycomp just equivalent to the old resolve? Unless people are passing in components via the ref? I have no idea why this method even takes in a ref comp

ElectroJr avatar Aug 07 '24 10:08 ElectroJr

yeah shouldnt foundComponent be out instead of ref

deltanedas avatar Aug 07 '24 11:08 deltanedas

Agreed, I switched it to out and tested that it works recursively as expected.

Fortunately I think I'm the only person who has tried to use this on content so there's nothing to fix!

IProduceWidgets avatar Aug 07 '24 16:08 IProduceWidgets

Isn't the trycomp just equivalent to the old resolve? Unless people are passing in components via the ref? I have no idea why this method even takes in a ref comp

I have no idea why it was using ref. I don't think there's any uses of the method on content, probably because of its scrungliness, and the method that returns all found parent components instead of the first one doesn't use ref and also uses trycomp instead. As for if they're functionally different, the resolve throws an assert if any of the parents while recursing don't have the component, which is no good here. Also as ref it required you to pass a ref, which is not needed imo, and unintuitive.

IProduceWidgets avatar Aug 12 '24 14:08 IProduceWidgets

Bump. It's just a bugfix, not new functionality.

IProduceWidgets avatar Oct 10 '24 18:10 IProduceWidgets

Hokay, made it ref again to avoid the breaky.

IProduceWidgets avatar Oct 15 '24 18:10 IProduceWidgets

Bump

IProduceWidgets avatar Dec 12 '24 22:12 IProduceWidgets