i have three objects (all exactly the same except the texture); they all have a script on them that measures the distance to the player and displays a gui texture when the player is near.
now all 3 scripts are exactly the same, but one of them works and the others don't. i even copied the working one into the other two - still, they won't do anything.
not working code:
the second code does not update the dist1 variable & the Debug Log from the update function does not return, so it has to be somewhere there (i think). if i try to return the value of dist1 later in the code it's '0'.
anyway, i'm running out of ideas. is it maybe not possible to do three different distance checks at the same time? should the distance check be on the player rather than the 3 objects?
asked Jul 26 '11 at 01:35 PM
Looks to me like the Update function in the second case is not being called. Are you sure the object this is on is enabled? Try Debug.Log("Update"); as the first line in the Update function as a baseline check.
answered Jul 26 '11 at 01:40 PM