public void DeleteModel(Guid modelGuid) { var objToDelete = ModelsOnTerrain.Where(x => x.ModelGuid == modelGuid).ToList(); foreach (var obj in objToDelete) { GameObject.Destroy(obj.GameObject); ModelsOnTerrain.Remove(obj); } GameObject.Destroy(Models[modelGuid].GameObject); Models.Remove(modelGuid); }
public void UpdateModelsOnTerrain(Guid modelGuid) { var toUpdate = ModelsOnTerrain.Where(x => x.ModelGuid == modelGuid).ToList(); foreach (var model in toUpdate) { var updatedObj = InstantiateModel(modelGuid); updatedObj.transform.position = model.GameObject.transform.position; updatedObj.transform.rotation = model.GameObject.transform.rotation; updatedObj.transform.localScale = model.GameObject.transform.localScale; GameObject.Destroy(model.GameObject); model.GameObject = updatedObj; } }