public void SetDelegateObject(UnityEngine.ScriptableObject value) { if (__SetDelegateObject_0_1 == null) { __SetDelegateObject_0_1 = (Action <UnityEngine.ScriptableObject>)Delegate.CreateDelegate(typeof(Action <UnityEngine.ScriptableObject>), m_instance, UnityTypes.UnityEditor_WebView.GetMethod("SetDelegateObject", R.InstanceMembers, null, new Type[] { typeof(UnityEngine.ScriptableObject) }, null)); } __SetDelegateObject_0_1(value); }
public bool DefineScriptObject(string path, UnityEngine.ScriptableObject obj) { if (__DefineScriptObject_0_2 == null) { __DefineScriptObject_0_2 = (Func <string, UnityEngine.ScriptableObject, bool>)Delegate.CreateDelegate(typeof(Func <string, UnityEngine.ScriptableObject, bool>), m_instance, UnityTypes.UnityEditor_WebView.GetMethod("DefineScriptObject", R.InstanceMembers, null, new Type[] { typeof(string), typeof(UnityEngine.ScriptableObject) }, null)); } return(__DefineScriptObject_0_2(path, obj)); }
// Creates a Unity .asset file in your project // storing data from the child class of ScriptableObject public static void CreateDataAsset <T>() where T : ScriptableObject { // Create a new data asset instance that is child of ScriptableObject T newAsset = ScriptableObject.CreateInstance <T>(); // Create a new file in the Project View on where ever the last selection was // and automagically offer the ability to rename the file! ProjectWindowUtil.CreateAsset(newAsset, "New " + typeof(T).Name + ".asset"); }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *__ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = new UnityEngine.ScriptableObject(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
private void createScriptable(Type type) { UnityEngine.ScriptableObject asset = UnityEngine.ScriptableObject.CreateInstance(type); string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath("Assets/" + type.ToString() + ".asset"); AssetDatabase.CreateAsset(asset, assetPathAndName); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
public static void CreateAsset(string typeName, UnityEngine.ScriptableObject instance) { #if UNITY_EDITOR instance.name = $"{typeName} Settings"; if (!System.IO.Directory.Exists("Assets/Resources")) { UnityEditor.AssetDatabase.CreateFolder("Assets", "Resources"); } UnityEditor.AssetDatabase.CreateAsset(instance, "Assets/Resources/" + typeName + ".asset"); #else throw new System.Exception("Can't create in runtime"); #endif }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UnityEngine.ScriptableObject gen_ret = new UnityEngine.ScriptableObject(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ScriptableObject constructor!")); }
static StackObject *set_data_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.ScriptableObject value = (UnityEngine.ScriptableObject) typeof(UnityEngine.ScriptableObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Tree instance_of_this_method; instance_of_this_method = (UnityEngine.Tree) typeof(UnityEngine.Tree).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.data = value; return(__ret); }
// [MenuItem("Assets/Create/OpenCog/Delegates")] public static void CreateAssets() { List <OCDelegate> delegates = new List <OCDelegate>(); MethodInfo[] delegateMethods = typeof(OCAction).GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); foreach (MethodInfo dmi in delegateMethods) { ParameterInfo[] paramInfo = dmi.GetParameters(); if (paramInfo != null && paramInfo.Length == 2 && paramInfo[0].ParameterType == typeof(OCAction)) { OCDelegate del = ScriptableObject.CreateInstance <OCDelegate>() .Initialize(Delegate.CreateDelegate(typeof(OCAction.OCActionCondition), dmi)); delegates.Add(del); } } //OCScriptableObjectAssetFactory.CreateAsset<OCDelegate>(); OCScriptableObjectAssetFactory.CreateAssets(delegates.ToArray()); }
public static void CreateScriptableAssetInCurrentSelection(UnityEngine.ScriptableObject instance, string name) { var path = "Assets/"; var obj = UnityEditor.Selection.activeObject; if (obj != null) { path = UnityEditor.AssetDatabase.GetAssetPath(obj.GetInstanceID()); if (System.IO.Directory.Exists(path)) { path += "/"; } else { path = path.Substring(0, path.LastIndexOf("/") + 1); } } path = path + name + ".asset"; path = UnityEditor.AssetDatabase.GenerateUniqueAssetPath(path); UnityEditor.AssetDatabase.CreateAsset(instance, path); }
static int _m_CreateInstance_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 1 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)) { string _className = LuaAPI.lua_tostring(L, 1); UnityEngine.ScriptableObject gen_ret = UnityEngine.ScriptableObject.CreateInstance(_className); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 1 && translator.Assignable <System.Type>(L, 1)) { System.Type _type = (System.Type)translator.GetObject(L, 1, typeof(System.Type)); UnityEngine.ScriptableObject gen_ret = UnityEngine.ScriptableObject.CreateInstance(_type); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ScriptableObject.CreateInstance!")); }
//--------------------------------------------------------------------------- #region Private Member Data //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Accessors and Mutators //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- /// <summary> // This makes it easy to create, name and place unique new ScriptableObject asset files. /// </summary> public static void CreateAsset <T>() where T : ScriptableObject { T asset = ScriptableObject.CreateInstance <T>(); string path = AssetDatabase.GetAssetPath(Selection.activeObject); if (path == "") { path = "Assets"; } else if (Path.GetExtension(path) != "") { path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), ""); } string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New " + typeof(T).ToString() + ".asset"); AssetDatabase.CreateAsset(asset, assetPathAndName); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }