How to write a script which move the character when the it entered an area?

I have a scene which has a high place and a lower place, so when i move the character to the higher place, it just goes straight to the solid cube(the ground), so i want to know how to wright a script using java which will automatically higher up the character when it goes to the higher place from the lower place, and will lower down when it goes to the lower place.

Depends on what your area is made of (terrain, mesh, 2d-graphics)

Normally this is nothing one scripts but something that is handled by the physics engine. You use colliders/controllers for that.

Example: you make a character and add component->physics->character_controller and a rigid body to it, you add a terrain-heightmap and add a component->physics->terrain_collider to it and the physics engine handles the rest.

Then you move your character NOT using transform+=x; BUT changing the velocity of it’s rigid body, like this maybe:

var Vertical: float = Input.GetAxis ("Vertical") * speed; 
var Horizontal: float = Input.GetAxis ("Horizontal") * rotationSpeed;
rigidbody.AddForce(Vector3(Horizontal,0,Vertical),ForceMode.VelocityChange);

Note that unity comes with prefabs for this, try this:

  1. start a new scene
  2. delete the main camera
  3. Add Terrain->Create Terrain
  4. Add A first person character controller (in the projects window standard assets/character controller/)
  5. Move your first person controller so you don’t fall into empty space

So you’ll have a walkable terrain. Other than that I recommend taking some video lessons to get started with unity. I recommend the one http://www.vtc.com/ has put out. Or Youtube.