Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Random.onUnitSphere

public static Vector3 onUnitSphere;

Description

Returns a random point on the surface of a sphere with radius 1 (Read Only).

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { GetComponent<Rigidbody>().velocity = Random.onUnitSphere * 10; } }