Quantcast
Channel: Questions in topic: "tagging"
Viewing all articles
Browse latest Browse all 120

How to Make a Transform Variable Target a Random GameObject?

$
0
0
I have a script where an object needs to target a random GameObject, it then immediately faces it and starts moving towards it (last bits not important). Does anybody have any ideas of how I can target a random gameObject. So far I have tried making a transform variable and setting it to an object with the tag 'Target' (I tagged my targets 'target'). public Transform tr_player; tr_Player = GameObject.FindGameObjectWithTag ("Target").transform; This always sets tr_player to my fifth target though, any other ideas?

Viewing all articles
Browse latest Browse all 120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>