言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Random.insideUnitCircle

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static var insideUnitCircle: Vector2;
public static Vector2 insideUnitCircle;
public static insideUnitCircle as Vector2

Description

半径1 の円の内部のランダムな点を返します (Read Only)

	// Sets the position to be somewhere inside a circle
	// with radius 5 and the center at zero.

	var newPosition : Vector2 = Random.insideUnitCircle * 5;
	transform.position.x = newPosition.x;
	transform.position.y = newPosition.y;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Vector2 newPosition = Random.insideUnitCircle * 5;
    void Example() {
        transform.position.x = newPosition.x;
        transform.position.y = newPosition.y;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public newPosition as Vector2 = (Random.insideUnitCircle * 5)

	def Example() as void:
		transform.position.x = newPosition.x
		transform.position.y = newPosition.y