private void Update() { // Spawn a basic spawned object when I is pressed if (Input.GetKeyDown(KeyCode.I)) { Vector3 position = Random.onUnitSphere * 2; Quaternion rotation = Random.rotation; SyncSpawnedObject spawnedObject = new SyncSpawnedObject(); SpawnManager.Spawn(spawnedObject, position, rotation, SpawnParent, "SpawnedObject", false); } // Spawn a test sphere when O is pressed if (Input.GetKeyDown(KeyCode.O)) { Vector3 position = Random.onUnitSphere * 2; Quaternion rotation = Random.rotation; SyncSpawnTestSphere spawnedObject = new SyncSpawnTestSphere(); spawnedObject.TestFloat.Value = Random.Range(0f, 100f); SpawnManager.Spawn(spawnedObject, position, rotation, SpawnParent, "SpawnTestSphere", false); } }
public void SpawnBasicSyncObject() { Quaternion rotation = Random.rotation; var spawnedObject = new SyncSpawnedObject(); spawnManager.Spawn(spawnedObject, PositionCalibrator(Camera.main.transform.position, cameraHeight: true), rotation, spawnParentTransform.gameObject, "SpawnedObject", false); }
public void SpawnBasicSyncObject() { Vector3 position = Random.onUnitSphere * 2; Quaternion rotation = Random.rotation; var spawnedObject = new SyncSpawnedObject(); spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, "SpawnedObject", false); }
public void SpawnBasicSyncObject() { // Vector3 position = Random.onUnitSphere * 2; Quaternion rotation = Random.rotation; Vector3 position = Camera.main.transform.forward + new Vector3(Random.Range(-5, 5), Random.Range(0, 1), 2); var spawnedObject = new SyncSpawnedObject(); spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, "SpawnedObject", false); }
// Use this for initialization public void SyncSpawnPrefab() { SyncSpawnedObject spawnedObject = new SyncSpawnedObject(); Vector3 position = syncPrefab.gameObject.transform.position; spawnManager.Spawn(spawnedObject, position, syncPrefab.gameObject.transform.rotation, null, "syncPrefab", true); }
protected void Spawn(SyncSpawnedObject spawnedObject, Vector3 position, Quaternion rotation, string baseName, bool isOwnedLocally) { spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, baseName, isOwnedLocally); }
/// <summary> /// Spawn a sync object at the position and with the rotation you want. /// </summary> public bool SpawnSyncObject(SyncSpawnedObject syncObject, Vector3 position, Quaternion rotation) { return spawnManager.Spawn(syncObject, position, rotation, spawnParentTransform.gameObject, syncObject.Name.Value, false) }