I have a prefab object that is a plane with a bullet hole texture on it. I can shoot objects just fine and spawn bullet holes where my ray cast hits, but my bullet holes are not following the object that I shoot. I am not sure what to do. What I do know what to do is to use the lines of code in the given piece of code:
What you have to do is parent the bullet holes to the object they hit.
Example:
//Lets make the prefab a Transform for ease of use
var prefab:Transform;
// At the start of your script create a temporary variable
private var tmpObject:Transform;
//When you instantiate you set the return to that variable
tmpObject = Instantiate(prefab, /*your code here*/);
//You then Make what it hit, the parent
tmpObject.parent = hit.transform;
//If you'r prefab is of a type other than Transform, you will have to access the transform before you can apply the parent
tmpObject.transform.parent = hit.transform;
If your objects scale is changed, you will have to come up with a work around, but for now it will work