heyo
I'm working on an auto-setup that bulk creates assets for another extension
for context
uniVrm requires for blenshapes to be assigned within it's custom asset type BlendshapeClip
what i'm doing is bulk creating them since it's a predetermined format (ARKIT)
BlendShapeClip clip;
string clip_path;
// does clip exist
string[] clip_guids = AssetDatabase.FindAssets(
filter: clip_name,
searchInFolders: new string[] { BlendShapeAvatarPath }
);
// maybe delete old asset? NOTE: asset is serialized and values cannot be overriden if already created
if (clip_guids.Length > 0)
{
clip_path = AssetDatabase.GUIDToAssetPath(clip_guids[0]);
clip = AssetDatabase.LoadAssetAtPath<BlendShapeClip>(clip_path);
}
else
{
clip_path =
$"{BlendShapeAvatarPath.Replace($"{BlendShapeAvatar.name}.asset", "")}{Path.DirectorySeparatorChar}{clip_name}.asset";
clip = CreateInstance<BlendShapeClip>();
AssetDatabase.CreateAsset(clip, clip_path);
}
the problem is that when i create the asset from scratch the changes i do to the asset are reflected and properly saved onto it, but when i instead load it using LoadAssetAtPath it does not reflect the changes and instead wipes any previous change completely
properties like clip.BlendShapeName are marked as [SerilizedField] in the uniVRM script
how can i have the asset changes save when loading from path an existing asset?
i never worked with serialized objects/field before so not sure where to go from here
i tried with this to no avail ```C#
clip.name = clip_name;
SerializedObject SerializedClip = new SerializedObject(clip);
SerializedClip.WriteProperty("BlendShapeName", clip_name);
SerializedClip.ApplyModifiedProperties();
