MovementUtility bug

MattShirley

New member
I have encountered a bug in /Behavior Designer Movement/Scripts/MovementUtility.cs for 2D projects.

The conditional block on line 153 currently looks like this:

Code:
                RaycastHit2D hit;
                if ((hit = Physics2D.Linecast(transform.TransformPoint(positionOffset), targetObject.transform.TransformPoint(targetOffset), ~ignoreLayerMask))) {
                    hitTransform = hit.transform;
                }

It does not work for me (specifically, a target never gets set in the Search action). I'm not a C# expert, but it does not appear assignment can be done in this fashion.

I have changed it to this and it works as expected:


Code:
                RaycastHit2D hit = Physics2D.Linecast(targetObject.transform.TransformPoint(targetOffset),
                    transform.TransformPoint(positionOffset), ~ignoreLayerMask);
                if (hit.transform != null) {
                    hitTransform = hit.transform;
                }

I am reporting here so that it can be resolved in the core package and I won't need to rely on my local changes.
 
Back
Top