- Home /
Question by
chachaneko12 · Apr 24, 2018 at 03:22 AM ·
c#unity 2dprogramming
Save randomly placed objects
What code do I need to save placed objects? Next I will write the code I wrote.
I really appreciate your looking over my question.. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int number = Random.Range (0, Prefab.Length); GameObject go = Instantiate (Prefab[number]) as GameObject; while (true) { float px = Random.Range (-9.0f, 8.0f); float py = Random.Range (-5.0f, 1.0f); go.transform.position = new Vector3 (px, py, 0);
Comment
what you mean with "save" ?
Store the position in a vector3 variable, and read when you need it.
If you talk about saving it, close the game, and be able to load again when the game opens again, it's a diferent thing, you have PlayerPrefs, or Serializeed fields...
Your answer
