- Home /
Question by
Shilka · Jul 18, 2015 at 06:06 AM ·
c#editorscriptableobject
ProjectWindowUtil.CreateAsset causes a memory leak
Hi, I created my ScriptableObject in an asset folder using ProjectWindowUtil.CreateAsset. newScriptableObject.asset has been created correctly but If I press Esc key during renaming and cancel creating asset, memory leak message is shown when saving the scene. How to solve the memory leak?
using UnityEngine;
using UnityEditor;
public class AssetCreationMenu : Editor
{
[MenuItem( "Assets/Create/Test")]
static void CreateTestScriptableObject()
{
TestScriptableObject newScriptableObject = ScriptableObject.CreateInstance<TestScriptableObject>();
ProjectWindowUtil.CreateAsset( newScriptableObject, "Assets/newTestScriptableObject.asset" );
}
}
public class TestScriptableObject : ScriptableObject { }
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220611231722im_/https://answers.unity.com/themes/thub/images/avi.jpg)