0
I’m trying the following:
When the enemy is instantiated I want him to target
my player, all right, but when the enemy comes to the game he does not fill the variable Alvo
as I pointed out below, the inspector looks like (None).
var Alvo : Transform;
function Update () {
if (!Alvo)
{
Alvo = GameObject.Find("/Tanque").transform;
}
Why are you going through
/
? This is to go through the hierarchy, your object "Tank" is inside another object?– DH.
yes he is inside another object
– Diogo
Try to do "Other Tank".
– DH.
blz, I’m going to go now
– Diogo
oops, I came back, it worked, it was like this code:
– Diogo
if (!Target) { Target = Gameobject.Find("tank/tank"). Transform; }
– Diogo
but I tried to put that code in the start, and it worked.
– Diogo
I want to thank you for your attention, thank you very much!
– Diogo
Answer your own question, just to be a reference for the next people who see it can get it out of the solution :)
– DH.