hmmm trying to learn just at least basics of unity3d programming from time to time nothing super complex XD the really complex stuff ill leave that to the programmer
for now
well trying to make a simple enemy AI chase player or detect player (in this case if enemy detects player is close enough changes material color to yellow)
I agree with toreau … use code tag.
You are asking “what’s wrong in the script ?”. I’ve lost my magic … you tell as what’s wrong, what’s going on, what compiler sais, what line ( if there is ) causin’ error ? More information.
lines 18 and 19, you got your brackets backwards, also you want to place the color changing code inside those brackets, it’s currently after that code block runs, which means it’ll go yellow in any situation. Hope this helps!
What I meant was (and also Disolution is correct, didn’t spot that lol, was getting tired at the time), this block of code:
if distance = distance > lookatdistance
}
{
should look like:
if distance > lookatdistance
{
}