ForceUpdate
How do I use Force Update
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
185 | AssetDatabase.ImportAsset(script, ImportAssetOptions.ForceUpdate); | 1 |
346 | AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); | 2 |
File name: PhotonConverter.cs
Copy
160 static void ConvertScripts(List161 {
162 bool ignoreWarningIsLogged = false;
163
164 foreach (string script in scriptPathList)
165 {
166 if (script.Contains("PhotonNetwork")) //Don't convert this file (and others)
167 {
168 if (!ignoreWarningIsLogged)
169 {
170 ignoreWarningIsLogged = true;
171 Debug.LogWarning("Conversion to PUN ignores all files with \"PhotonNetwork\" in their file-path.\nCheck: " + script);
172 }
173 continue;
174 }
175 if (script.Contains("Image Effects"))
176 {
177 continue;
178 }
179
180 ConvertToPhotonAPI(script);
181 }
182
183 foreach (string script in scriptPathList)
184 {
185 AssetDatabase.ImportAsset(script, ImportAssetOptions.ForceUpdate);
186 }
187 }
File name: PhotonConverter.cs
Copy
341 static void EnsureFolder(string path)
342 {
343 if (!Directory.Exists(path))
344 {
345 Directory.CreateDirectory(path);
346 AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
347 AssetDatabase.Refresh();
348 }
349 }
ForceUpdate 143 lượt xem
Gõ tìm kiếm nhanh...