Attachments for Unity

This section covers how to send different types of attachments with each bug report for your Unity apps.

The main attachment sent with any bug report is the screenshot taken when the SDK was invoked. The users can annotate this screenshot.

Instabug Attachments

The main attachment sent with any bug report is the screenshot taken when the SDK was invoked. The users can annotate this screenshot.

Extra Attachments

The SDK allows you to attach custom files to reports. You can attach up to 3 files, each up to 5 MB.

2888

Extra Attachment - Dashboard

Use the following method to add a new file attachment.

string data = "New data text";
string filePath = Application.persistentDataPath + "/testFile.txt";
StreamWriter sr = File.CreateText (filePath);
sr.WriteLine (data);
sr.Close ();

Instabug.AddFileAttachmentWithURL(filePath);

A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy attached to your bug reports will always contain that latest changes at the time of sending the report.

Each call to this method adds the file to the files attached until a maximum of 3 then it overrides the first file. The file has to be available locally at the provided path when the report is being sent.

To clear list of files to be attached to reports, use the following method:

Instabug.ClearFileAttachments();

This method doesn't delete any files from the file system. It will just remove them from the list of files to be attached to each report.