Instantiate objects around a sphere

I made a little room and a character in my scene. Now that character felt pretty alone in his room, so I made a ‘SpawnCharacter’ script and a UI button to launch it. The room got full quite quick and so my character left the room and stepped on a planet. Now he’s alone again, but my script for spawning him some friends doesnt work outside of the room. I need to make sure that the characters wouldn’t spawn inside the planet. How would I do that?

My SpawnCharacter script for the room:

public class UIController : MonoBehaviour {

    public GameObject spawnCharacter;
    public Vector3 spawnOrigin;
    public Vector3 spawnRange;

    public void SpawnCharacter() {
        Vector3 spawnPosition = new Vector3(
           spawnOrigin.x + Random.Range(-spawnRange.x, spawnRange.x),
           spawnOrigin.y + Random.Range(-spawnRange.y, spawnRange.y),
           spawnOrigin.z + Random.Range(-spawnRange.z, spawnRange.z));
        Quaternion spawnRotation = Quaternion.identity;
        GameObject newCharacter = Instantiate(spawnCharacter,
           spawnPosition, spawnRotation) as GameObject;        

A simple application of Random.onUnitSphere should do the trick.

Vector3 spawnPosition = Random.onUnitSphere * (planetRadius + characterHeight * 0.5f) + planetPosition;
GameObject newCharacter = Instantiate(spawnCharacter, spawnPosition, Quaternion.identity) as GameObject;
newCharacter.transform.Rotate(-90, 0, 0);

Great answers above … thank you to each and every contributor. I’d only like to add that if you’re using “RaycastHit.point” information to spawn objects on the sphere (using mouse or touchscreen) just normalize the value using Vector3.Normalize()

Vector3 spawnPosition = Vector3.Normalize(raycastHit.point) * ((planet.transform.localScale.x/2) + character.transform.localScale.y * 0.5f) + planet.transform.position;