问题:我先说我的问题  项目中有两个FileStream  忘了关闭文件流,我不知道你的跟我一不一样的情况

解决办法:Ctrl + F,搜索项目里所有的  FileStream , 看结尾有没有关闭文件流

fs.Flush();
fs.Close();

示例:

    // 截图IEnumerator ScreenShoot(){yield return new WaitForEndOfFrame();//等某一帧结束Texture2D t = new Texture2D(cameraTexture.width, cameraTexture.height);t.SetPixels(cameraTexture.GetPixels());t.Apply();byte[] byt = t.EncodeToPNG();// 该函数会直接覆盖已存在的同名文件// File.WriteAllBytes(screenCapturePath, byt);FileStream fs = File.Open(screenCapturePath, FileMode.OpenOrCreate,FileAccess.ReadWrite,FileShare.ReadWrite);fs.Write(byt, 0, byt.Length);fs.Flush();fs.Close();Debug.Log("图片已保存");
#if UNITY_EDITOR || UNITY_ANDROID//这里的代码在IOS和Android平台都会编译UnityEditor.AssetDatabase.Refresh();
#endif}

Unity IOException: Sharing violation on path相关推荐

  1. IOException: Sharing violation on path 异常

    有时候需要,将一些数据覆盖的写入本地,然后分析问题. .... fullPathWithName += extension;if(File.Exists(fullPathWithName)) {Fil ...

  2. Unity3d 报错”IOException: Sharing violation on path *******”解决方式

    问题 在写入文件的过程中一直报这个错误,大致意思是共享破坏的意思,可能是路径操作中出现了问题,代码大致如下: fi = new FileInfo(LogPath);if (!fi.Exists)sw ...

  3. IOException:Sharing Violation on Path

    这个错遇到很多次了 我遇到这个错误的原因是用 File.WriteAllText(txtPath, content);这个API写入txt文本文档的时候,需要在后面指定一个编码格式,否则默认的两个参数 ...

  4. Encountered a sharing violation while accessing

    今天用Keil5编译的时候突然出现的这个问题,以前也没遇到过. 1.问题: 编译报错:Encountered a sharing violation while accessing 中文原意:访问时遇 ...

  5. Cannot save file. Sharing violation

    VC6.0 File->New->Project->MFC AppWizard(exe)->Dialog Based 然后保存,出现一个对话框:F:\题目\3\3.rc Can ...

  6. unity bug(Copying assembly from ‘Temp/Assembly-CSharp.dll‘ to ‘Library/ScriptAssemblies/Assembly-CSh

    bug Copying assembly from 'Temp/Assembly-CSharp.dll' to 'Library/ScriptAssemblies/Assembly-CSharp.dl ...

  7. Copying assembly from ‘Temp/Unity.RenderPipelines.Core.Runtime.dll‘ to ‘Library/ScriptAssemblies/...

    问题描述: Unity 报错,在 Unity 导入 Creator kit: Beginner Code 项目时出现错误: Copying assembly from 'Temp/Unity.Rend ...

  8. 【解决】Copying assembly from ‘Temp/Assembly-CSharp.dll‘ to ‘...../Assembly-CSharp.dll` ....

    开发平台:Unity 编程平台:Visual Studio 2017以上 使用语言:C#   问题描述: 原文 Copying assembly from 'Temp/Assembly-CSharp. ...

  9. SIGGRAPH 2020大会上的Unity:在线汇集创作者社区

    Unity is proud to be a Champion Sponsor of the SIGGRAPH 2020 Virtual Conference, enabling creators e ...

最新文章

  1. 乾坤 微前端_微前端架构初探以及我的前端技术盘点
  2. Python使用文本拼图
  3. 20 个最常用的 Git 命令,码住!
  4. Winform中使用DevExpress时给控件添加子控件的方法
  5. Crossing River(信息学奥赛一本通-T1232)
  6. canvas技术整理
  7. [转]云计算:SaaS、PaaS、IaaS、CaaS
  8. reflect动画_3DSMAX制作超时空未来动画场景-3D建模场景模型教程
  9. svn windows迁到linux,svn从Windows服务器上迁移到Linux上
  10. 极速PDF编辑器提示缺少字体如何解决
  11. matlab计算一组数的函数值_「数学建模」MATLAB的数值计算
  12. 显卡和主板供电接详解图解
  13. autorunner
  14. php 搜索引擎 分词_怎么在php中使用scws实现一个中文分词搜索功能
  15. 无心剑中译伊玛·拉扎罗斯《新巨人·自由女神》
  16. 2014湖南农业大学ACM校赛
  17. linux中C语言获取高精度时钟gettimeofday函数
  18. PXI-10024100KSps、24Bit数据采集模块
  19. java将中文转为拼音
  20. 图片批量压缩方法及步骤

热门文章

  1. 为什么说 Flutter 可能不是下一件大事?
  2. 解决连通性问题的利器:并查集
  3. 迫在眉睫的企业内控与跃跃欲试的IT
  4. 从爆红到凉凉,「蚂蚁呀嘿」只用了 7 天
  5. thinkphp5阿里云SDK短信验证
  6. stem教育小学制度管理
  7. hydra笔记-利用hydra暴力破解ssh弱口令
  8. svchost.exe占用内存过高
  9. B/S聊天室(websocket)
  10. mov,lea指令的区别