- Home /
How can I override or Update the .asset file from Script? Currently using AssetDatabase.CreateAsset() for Creating the asset.
what I am Doing?
Currently I am trying to save current Mesh in my .asset File when user will click a Save button using AssetDatabase.CreateAsset() but when the user will again press the save button unity starts throwing error. (maybe because CreateAsset() first checks whether the file exists or not [in this case it already exists]).
I can't use Delete() because there is an another GUI button LOAD which will load the current Saved Mesh say [xyzold.asset]
Next What I tried ?
Searched the Problem whether it already exists or not?
Then I tried and thought it like this .. I will save the same mesh in another file [ say xyznew.asset ] and then I will change the Mesh[mesh of 3d object] to the newFile and then will delete the old Mesh file [xyzold.asset] and will save the Mesh again but fileName will be save as the previous old file name[xyzold.asset] .. now I will update my Mesh[mesh of 3d object] with the old one and delete the New one ...[ This Was to remove mesh Link from the MeshFilter so when user updates the mesh will not be destroyed]...
,I am trying to save the current mesh to my Asset folder using AssetDabase.CreateAsset() but when I again Press the button to Save the Mesh unity starts throwing the error.
I cannot use Delete() because There is a GUI button to Load the Current saved Mesh
What I tried and thought was to make an another file[ say filexyx.asset] using AssetDabase.CreateAsset() then update the mesh with the new file, then delete the Previous file, create the newFile of the original mesh I wanted and delete the filexyz.asset.
still not working for me...
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How do I return the path of a sub-asset in an AssetDatabase ? 0 Answers
Prevent changes in ScriptableObject type Asset in Editor. Dont save it. 0 Answers
AssetDatabase.Refresh() no longer recompiling my generated scripts 0 Answers