[RESOLVED] Detect simply doesn't work?« Back to Previous Page
I must be doing something wrong, but I have simplified things as much as possible. I have a simple behavior tree Parallel detect customAction (just Debug.Log of form variable from detect). The AI Object and a target object (simple capsule with an Entity on it) are sitting right together, within the range of the sensor (called "Radar"). I definitely have the sensor names, aspect names, form variable names correct. With or without quotations around the sensor and aspect name in the detect node. It simply doesn't work. I can't fathom why, unfortunately; I've tried every combination and cannot simplify the problem more. I can set the debugger in the customAction and the form variable from the detect node never gives anything. This is very frustrating.
Well I went back to looking at this today, comparing against WanderAndAttackTutorial3 (updated to 2.0.8). I had the expression I’d added in the custom action (which just displayed the name of the detected gameObject) set as ”radarTarget” rather than radarTarget (without quotes). This was the only difference I could identify between my simple tree and similar nodes in the attacker tree from the tutorial project. With that change it worked. I believe I also changed my root node from repeat-forever to repeat-never. So now it works. I thought I’d tried all combinations of quotes-and-not-quotes in the various expression fields, but clearly I missed this one. So in the expressions on the Detect node quotes are mandatory on Sensor and Aspect, forbidden on Form Variable (expected as it isn’t marked as an expression). However, everywhere else (custom action expressions, Constraint constraints) it is forbidden. I expect because the Sensor and Aspect values are names rather than variables. It makes sense, but is a bit counterintuitive.