How to use the file I just copied to the project right away

I use the System.IO.File.Copy copy file to my project, then use the copy file right away(like targetNode.imageComp.sprite = AssetDatabase.LoadAssetAtPath(copyFilePath) or TMP_FontAsset.CreateFontAsset), but it cant show and cant use. Use it will return null. How do I use the copied files correctly? (If I select the wrong post tag or section again, please let me know and tell me how to correct the error。 QAQ)

You probably need to AssetDatabase.Refresh, or specifically import the asset: Unity - Scripting API: AssetDatabase.ImportAsset

1 Like

yes thanks!AssetDatabase.Refresh .Would I be asking a question that would be so stupid as to waste public resources, just because I’m rookie to Unity :smiling_face_with_tear: