- 956 名前:名前は開発中のものです。 mailto:sage [2017/12/17(日) 02:16:48.31 ID: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; } }
|

|