Help problem with Trigger

i want, if Player near Wall, Player HandsUp.

var anim: GameObject;

function OnTriggerEnter(){
	if(GameObject.FindGameObjectWithTag("Wall") == null){
			
		anim.animation.CrossFade("HandUp");
		   		
	}
	    	
}

this script and Trigger Collider put on Player, it’s doesn’t work…

NB: sorry for My bad English…

I don’t understand how you want this code to check if the player is near the wall, this code will only run if the player touches something other than the wall. not neccessarrilly near the wall. how about an update function instead,

function Update(){
           if(player.transform.position.x -wall.transform.position.x <= 5 || player.transform.position.x -wall.transform.position.x >= -5 || player.transform.position.z -wall.transform.position.z <= 5 || player.transform.position.z -wall.transform.position.z >= -5 || player.transform.position.y -wall.transform.position.y <= 5 || player.transform.position.y -wall.transform.position.y >= -5){
                //do whatever you want to do
            }
    }

this if statement will run when you character is in proximity of this wall you speak of.

another possibility would be to simply create an invisible trigger outside of the box, and then use the OnTriggerEnter function

You can also try this:

function OnTriggerEnter(Collider collider)
{
   if (collider.gameObject.CompareTag("Wall"))
   {
       anim.animation.CrossFade("HandUp");
   }
}

And don’t forget to enable “IsTrigger” on the gameObjects.

I’m a beginner in Unity3d, but i hope it helps.