Stop LookAt Function. Lock the rotation

Hi Community!
I have a problem. I want my enemy to LookAt the when the player isnt looking at him:

if(renderer.isVisible)
		    {
			Debug.Log("i can see you");
                    //insert Stop Lookat thingy here
		    }
			
			if(!renderer.isVisible)
		    {
			transform.LookAt(player);
			Debug.Log("Can't see you");
		    }

so how can i stop the Lookat function?

well first i made a boolean called “looking” and made it false. then i…
well here’s the code:

		if(looking)
		{
			transform.LookAt(player);
			Debug.Log("he's looking at you");
		}
		
			if(renderer.isVisible)
		    {
			Debug.Log("See you");
			looking = false;
		    }
			
			if(!renderer.isVisible)
		    {
			Debug.Log("Can't see you");
			looking = true;
		    }

thats how i did it! :slight_smile: