17/12/17 02:16:48.31 K2bL8mhm.net
public GameObject Obj; //prefabを指定しておく
Rigidbody2D Rb2D;
public class PrefabCode : MonoBehaviour {
void Update() {
if (Input.GetMouseButton(0)) {
Vector3 position = new Vector3(Random.Range(-10.0f, 10.0f), 10, 0);
GameObject Prefab = Instantiate(Obj, transform.position, Quaternion.Euler(x, y, z));
Rb2D = Prefab.GetComponent<Rigidbody2D>();
Rb2D.gravityScale = 1.0f;
}
}