static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif SpriteScriptableObject o; o = new SpriteScriptableObject(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int set_sprite(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif SpriteScriptableObject self = (SpriteScriptableObject)checkSelf(l); UnityEngine.Sprite v; checkType(l, 2, out v); self.sprite = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static void Export() { foreach (Object sprite in Selection.objects) { if (sprite is Sprite == false) { continue; } string strPath = AssetDatabase.GetAssetPath(sprite); strPath = Path.GetDirectoryName(strPath); SpriteScriptableObject sp = ScriptableObject.CreateInstance <SpriteScriptableObject>(); sp.sprite = sprite as Sprite; AssetDatabase.CreateAsset(sp, strPath + "/" + sprite.name + ".asset"); } AssetDatabase.SaveAssets(); }