Question by 
               HIXO_ · Dec 24, 2020 at 09:24 PM · 
                instantiatetransformparent-child  
              
 
              Child Instantiated GameObject to GameObject hit by raycast
Hi all, I'm trying to child an instantiated GameObject to another GameObject hit by a raycast but my method has yielded no new changes/results.
Here is my Code:
  if (Physics.Raycast(generalCam.transform.position, forwardVector, out hit, range, environmentLayer))
      {
           GameObject impactGO = Instantiate(impactEffect, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
      
           impactGO.transform.SetParent(hit.transform);
      
           Destroy(impactGO, 5f); 
      }
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by HIXO_ · Dec 25, 2020 at 02:28 AM
Turns out I left an if statement in that I was no longer using preventing my code from running properly
Your answer