Last active
June 14, 2017 17:48
-
-
Save unity3dcollege/1f37a2ebe0e6c0c6629f2dccb528f3d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class CubeSpawner : MonoBehaviour | |
{ | |
private void OnEnable() | |
{ | |
int cubeCount = RemoteSettings.GetInt("cubesToSpawn"); | |
for (int i = 0; i < cubeCount; i++) | |
{ | |
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); | |
cube.transform.position = GetRandomPosition(); | |
} | |
} | |
private void Update() | |
{ | |
RemoteSettings.CallOnUpdate(); | |
} | |
private Vector3 GetRandomPosition() | |
{ | |
return new Vector3( | |
Random.Range(-5, 5), | |
Random.Range(-5, 5), | |
Random.Range(-5, 5)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment