Answer by weltraumaffe
`GameObject.Find()` finds only one GameObject. With `GameObject.FindGameObjectsWithTag()` you can find every Game Object with a specific tag. Beware: Find functions are very slow and shouldn't be used...
View ArticleAnswer by weltraumaffe
With `gameObject.FindComponentsInChildren(MeshRenderer)` you can find all mesh renderers in children of the gun. This method is very slow so you should use it in Start() once and not every time you...
View ArticleAnswer by weltraumaffe
Could you check in the Hierarchy if the Camera has the MainCamera tag attached to it? If not then `Camera.main` is not set (null) You should use `ScreenToWorldPoint`, you want to convert a position...
View ArticleAnswer by weltraumaffe
You should either use a GUI (and transform the WorldCoordinates to ScreenCoordinats and draw a label there). Or you should make the gameobject with the text a child of the object where it should be...
View Article