Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question GameObject doesn't work, pls help

Discussion in 'Visual Scripting' started by usovichden, Apr 20, 2021.

  1. usovichden

    usovichden

    Joined:
    Apr 19, 2021
    Posts:
    4
    Hi guys, I'm very newbie and I don't know what to do with this problem. I make some Bolt scheme which goal is to choose some object on desk and return mouse coordinates, but when I try to run it I have next notification: "Invalid operation exception: Missing target object for 'UnityEngine.GameObject.gameObject'
    Pls help me, screenshots attached
     
  2. BeeBeeCue

    BeeBeeCue

    Joined:
    Feb 13, 2018
    Posts:
    3
    What gameObject do you have the flowGraph on?
    Does it have a rigidbody?
     
  3. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,116
    Looks like you're raycasting on mouse position every frame which means that when the ray does not hit anything, the GameObject is null. You need to introduce a "Null Check" node to work around this issue so when the ray does not hit an object, it stops the logic before it throws the error.