Merge pull request #1465 from ousttrue/fix/onAddCallback

Unity 2020 以降のエディターで ファイルダイアログを開くとローカル変数の SerializedProperty が揮発する?
This commit is contained in:
ousttrue 2022-01-17 21:10:54 +09:00 committed by GitHub
commit 6a22ff958f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,27 +76,27 @@ namespace VRM
m_clipList.onAddCallback += (list) =>
{
// Add slot
prop.arraySize++;
// select last item
list.index = prop.arraySize - 1;
// get last item
var element = prop.GetArrayElementAtIndex(list.index);
element.objectReferenceValue = null;
// OpenFile dialog, create new BlendShapeClip
var dir = Path.GetDirectoryName(AssetDatabase.GetAssetPath(target));
var path = EditorUtility.SaveFilePanel(
"Create BlendShapeClip",
dir,
string.Format("BlendShapeClip#{0}.asset", list.count),
"asset");
BlendShapeClip clip = null;
if (!string.IsNullOrEmpty(path))
{
var clip = BlendShapeAvatar.CreateBlendShapeClip(path.ToUnityRelativePath());
clip = BlendShapeAvatar.CreateBlendShapeClip(path.ToUnityRelativePath());
//clip.Prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GetAssetPath(target));
element.objectReferenceValue = clip;
}
// Add slot
prop.arraySize++;
// select last item
list.index = prop.arraySize - 1;
// get last item
var element = prop.GetArrayElementAtIndex(list.index);
element.objectReferenceValue = clip;
};
m_clipList.onSelectCallback += (list) =>