예제 #1
0
        public static void ConvertToActionListAsset(MenuCommand command)
        {
            ActionList       actionList = (ActionList)command.context;
            ScriptableObject t          = CustomAssetUtility.CreateAsset <ActionListAsset> (actionList.gameObject.name);

            ActionListAsset actionListAsset = (ActionListAsset)t;

            actionListAsset.CopyFromActionList(actionList);
            AssetDatabase.SaveAssets();
            EditorGUIUtility.PingObject(t);

            EditorUtility.SetDirty(actionListAsset);
        }
예제 #2
0
        public static void ConvertToActionListAsset(MenuCommand command)
        {
            ActionList actionList = (ActionList)command.context;

            bool referenceNewAsset = EditorUtility.DisplayDialog("Reference asset?", "Do you want the existing ActionList '" + actionList.name + "' to use the new ActionList asset as it's Actions source?", "Yes", "No");

            ScriptableObject t = CustomAssetUtility.CreateAsset <ActionListAsset> (actionList.gameObject.name);

            ActionListAsset actionListAsset = (ActionListAsset)t;

            actionListAsset.CopyFromActionList(actionList);
            AssetDatabase.SaveAssets();
            EditorGUIUtility.PingObject(t);

            EditorUtility.SetDirty(actionListAsset);

            if (referenceNewAsset)
            {
                actionList.source    = ActionListSource.AssetFile;
                actionList.assetFile = actionListAsset;
            }
        }