Programmer
Programmer

Reputation: 125455

Detect and refresh Editor when new file is copied into Unity project Directory

I am making an Editor plugin that automatically copies a file from another folder that is outside the project directory into the Unity project.

I use File.Copy to do this and it works but the problem is that, for the file that is copied to be able to show up in the Project tab, I have to click outside Unity then click on Unity again. After this, the file will be visible.

Another way to put this is that I have to shift focus to another application then shift focus to Unity before Unity loads and display the file that is copied into its Project's directory.

How can I make the file show up in the Project tab once I execute File.Copy without clicking outside Unity and inside the Unity Editor?

Upvotes: 1

Views: 3183

Answers (1)

Harry
Harry

Reputation: 5707

Try this: AssetDatabase.Refresh()

Upvotes: 3

Related Questions