// 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); }
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 OnInputClicked(InputClickedEventData eventData) { Vector3 position = new Vector3(0, 0, 3f); Quaternion rotation = Quaternion.identity; var spawnedObject = new SyncSpawnedObject(); this.spawnManager.Spawn(spawnedObject, position, rotation, null, "SpawnedCube", true); }
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); }
private void Cleanup() { // if we have a model if (this.sharingModelData != null) { // delete it SpawnManager.Delete(this.sharingModelData); } // reset our internal state this.sharingModelData = null; isInitialized = false; }
private void NotAkeywOrDPlzSXz() { this.sharingModelData = new SyncSpawnedObject(); // if we don't have a spawn manager try to auto find one if (this.SpawnManager == null) { this.SpawnManager = AutoSharedObjectPrefabManager.Instance.GetComponent <PrefabSpawnManager>(); } // we'll use this status flag to track success or failure bool status = false; // if we still don't have a spawn manager we're out of luck if (this.SpawnManager != null) { Debug.Log("Calling spawn" + Environment.StackTrace); // however, if we do have one, we try to use it status = this.SpawnManager.Spawn(sharingModelData, this.transform.position, this.transform.rotation, this.transform.localScale, this.transform.parent == null ? null : this.transform.parent.gameObject, this.name, true); Debug.Log("status " + status); } // depending on the status flag, we communicate success or failure if (!status) { // This could occur if this object is not a prefab, or if that prefab is not registered // with the PrefabSpawnManager Debug.LogWarning("Unable to spawn sharing representation of '" + transform.name + "'"); this.sharingModelData = null; } else { Debug.Log("Spawned sharing representation of '" + transform.name + "'"); isInitialized = true; } }