How to make a script which will let the character not enter the wall(solid)

How to write a script which let the character not enter the wall? Plz tell me details, caz i really have no idea after i saw some answers on internet.

My first instinct: the wall needs a mesh collider component.

If you have a reference to the game object for the wall in your script, try in C#

if (myGameObject.collider==null)

myGameObject.AddComponent<MeshCollider>();

Or from the editor you can just add the collider to the wall.

Make sure your walls (objects) have colliders (highlight character, components > Physics > Mesh [box, etc] Collider)are are set to static objects (select object, check upper right box in the Inspector saying ‘static’)

╭⌒╮WELCOME ONLINE STORE :

http://www.goodshopping100.com

very good shopping web

The website wholesale for many kinds of fashion shoes,

like the nike,jordan,prada, also including the
jeans,shirts,bags,hat and the decorations.

All the products are free shipping, and the the price is

competitive,

and also can accept the pyapal payment.

after the payment, can ship within short time.

watches price 75$

Air jordan(1-24)shoes $30

Nike shox(R4,NZ,OZ,TL1,TL2,TL3) $35

Hndbags(Coach lv fendi d&g) $35

┏☆━━━━━━━━━━━━━━━━━━━━━☆┓
website: http://www.goodshopping100.com
┗☆━━━━━━━━━━━━━━━━━━━━━☆┛

Tshirts (Polo ,ed hardy,lacoste) $16

Jean(True Religion,ed hardy,coogi) $30

Sunglasses(Oakey,coach,gucci,Armaini) $15

New era cap $10

Bikini (Ed hardy,polo) $25

we wii give you a big discount

FREE SHIPPING,accept paypal

lower price fast shippment with higher quality

BEST QUALITY GUARANTEE!!

SAFTY & HONESTY GUARANTEE!!

FAST & PROMPT DELIVERY GUARANTEE!!

our moncler coat website: ★ http:// www.goodshopping100.com

Believe that you will fall in love with it

Opportunity knocks but once