public ShaderWithDateTime(T shader, DateTime lastModified, bool saveByteCode) { m_Shader = shader; m_LastModified = lastModified; if (!saveByteCode) { return; } do { m_CachePath = Path.Combine(AppPath.GetUserDataDir("ShaderCache"), string.Format("{0}.{1}", Guid.NewGuid(), "cso")); } while (File.Exists(m_CachePath)); Directory.CreateDirectory(PathHelper.GetDirectoryName(m_CachePath)); File.WriteAllBytes(m_CachePath, shader.ObjectByteCode); }