Skip to content

Instantly share code, notes, and snippets.

@unity3dcollege
Last active June 14, 2017 17:48
Show Gist options
  • Save unity3dcollege/1f37a2ebe0e6c0c6629f2dccb528f3d1 to your computer and use it in GitHub Desktop.
Save unity3dcollege/1f37a2ebe0e6c0c6629f2dccb528f3d1 to your computer and use it in GitHub Desktop.
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