title: can i move a gameObject based on just its name?
body: <p>Im using a raycast, putting its <code>RaycastHit</code> into a variable called <code>raycastHit</code>, using that to get the <code>raycastHit.transform.name</code>, could i then use the information from the name of the <code>gameObject</code> to move its position? Or if not, could i get the information from the <code>raycastHit</code> to instead move it straight away? (outside of the function of the raycast) I already looked for an answer, but ive been only finding results on how to move any <code>gameObject</code>.</p>
  <p>EDIT1:
  my current version of the void:</p>
  <pre><code>public RaycastHit raycastHit;
      private void HandleHookShotStart()
      {
          
          if (TestInputDownHookShot())
          {
              int gm = LayerMask.NameToLayer(&quot;Ground&quot;);
              int lwm = LayerMask.NameToLayer(&quot;LightWeight&quot;);
              int layers = 1 &lt;&lt; gm | 1 &lt;&lt; lwm;
              if (Physics.Raycast(Shoulder.transform.position, cam.transform.forward, out raycastHit, float.PositiveInfinity, layers))
              {
                  //Hit Something
                  debugHitpointTransform.position = raycastHit.point;
                  hookshotPosition = raycastHit.point;
                  hookShotSize = 0f;
                  HookShotTransform.gameObject.SetActive(true);
                  HookShotTransform.localScale = Vector3.zero;
  
                  if (raycastHit.collider.gameObject.layer == gm)
                  {
                      Debug.Log(&quot;ground&quot;);
                      hitType = HitType.Ground;
                  }
                  else if (raycastHit.collider.gameObject.layer == lwm)
                  {
                      //Debug.Log(&quot;lightweight&quot;);
                      hitType = HitType.Lightweight;
                      goToMove = raycastHit.collider.gameObject;
                      string raycastHitObjectname = goToMove.name;
                  }
  
                  state = State.HookShotThrown;
              }
          }
  
          
      }
  </code></pre>
  <p>EDIT2:</p>
  <pre><code>private void HandleHookShotGrab()
      {
          GameObject raycastHitObject = GameObject.Find(raycastHitObjectName);
      }
  </code></pre>
  <p>error is on <code>raycastHitObjectName</code>
  error:</p>
  <pre><code>CS0103 the name 'raycastHitObjectName' does not exist in the current context
  </code></pre>