创建ScriptableObject数据一些坑


using UnityEditor;
using UnityEngine;
///


/// 创建喷漆数据类型
///

public class CreatAssetUtil : ScriptableObject
{

    [MenuItem("Assets/Create/CoatPaintSprayUIStepConfig")]
    public static void CreateCoatPaintSprayUIStepConfig()
    {
        CoatPaintSprayUIStepConfig asset = ScriptableObject.CreateInstance();
        
        AssetDatabase.CreateAsset(asset, "Assets/[Game]/Resources/MatchData/Config/CoatPaintSprayUIStepConfig.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
        AssetDatabase.Refresh();
    }
}

 


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CoatPaintSprayUIStepConfig : ScriptableObject
{
  
    public int _CurrentThrough;

   
    public int _CurrentStep = -1;
 
    public int _TotalThrough = 2;

  
    public Sprite _CoatSpraySprite;

 
    public List _SprayThroughTextList = new List();

 
    public int _GunType;

 
    public int _GunAuxiliaryLine;


    public List _CoatPaintCompleteSpray;


    public List _SprayTime = new List();


    public List _SprayCollimationTime = new List();

  
    public List _OverlappingCollimation;

    public List _GunName = new List();
}


类名一定要相同,类一定要单独创建脚本

你可能感兴趣的:(编程语言)