Null gameobject and get gameobject when raycast detected gameobject with tag

mo D 2 years ago updated by Max Ivanchenko 2 years ago 1


I just watched the AI behaviour tutorial and I started to modify it for learning.


I'm having a problem that I try to make the monster chase and attack another monster, but I would like the "target" assigned by the raycast

I added a new "Object Variables" named "Target" and "Type" is "Gameobject", "Set Variable" after the "raycast" "get Game Object" and "Get Variable" before "Get Position".

However, the system doesn't get the Game Object variable and pass null to the Get Position.

Can I have some help with it? Is there any logic problem in my modification?

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Hi - very strange graph to me)

1 - Why there is "emeny"? You mean - "enemy"? )

2 - Why this Get and Set variable node marked as scene variable? - you have an object variable type

3 - Why this variable is float?

You want to send the gameobject to variable, just make the null variable (or gameobject variable with reference to other prefab) and Get position will work even if it is marked as yellow warning.