0

Null gameobject and get gameobject when raycast detected gameobject with tag

mo D 1 year ago updated by Max Ivanchenko 1 year ago 1

Hello,

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

https://www.youtube.com/watch?v=u_7dgkM-DNg

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:
Platform(s):
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.