Selecting gameobjects in game,

Hey! Need help with a script, the thing is that i want to be able to click a gameobject, in game and i want it to get highlighted, and set som kind of variable. Final result is that i can click a character and be able to walk around with that one instead of the main character. How to?

Cheers!

If you group the characters into one gameobject, and then get the control to swich when you press a button (like the guns on the FPS tutorial) then that would work link

http://unity3d.com/support/resources/example-projects/procedural-examples In one scene you can paint on the surface of a sphere and in an other you can grab the endpoints of the lightning bolts around. Checking the corresponding scripts should get you started I presume.

Take a look at this object selection snippet for a start. You could 'highlight' the object by changing its material, and you should know how to set variables (if you don't, you should work through some tutorials to learn unity fast).

For switching control between characters, I would probably have the same 'player' script on both, and when you click on a new 'player', disable the current 'player' script and enable the 'player' script on the newly-selected character. You'll need to use GetComponent to find the script instance, and then set the script instance '.enabled' to true/false accordingly.

This should get you started. If you haven't already worked through some tutorials, I would strongly recommend you do so before attempting any substantial project.