RayCasting from a Empty GameObject


Does anybody here know how to assign empty gameobject’s coordinates to a script rather than setting it up in the inspector? For instance, I want to shoot a raycast from a gun barrel. Problem is I want the script to know where the coordinates is before I save the script.

I do not want to assign this in the inspector because I have to keep reassigning it to the script everytime I run the game. Would tags help for this? If so, how can I use it to assign the coordinates of the empty game object?


transform.position will get you the current world position of the object the script is applied to.