Example #1
0
        public static bool CreateWorldPropertyAsset(WorldProperty property, string fileName)
        {
            if (!fileName.EndsWith(".asset"))
            {
                fileName += ".asset";
            }

            if (DoesAssetExist(fileName, WorldPropertyPath))
            {
                Debug.LogErrorFormat("Already created asset with name {0}", fileName);
                return(false);
            }

            WorldPropertyScriptable scriptable = ScriptableObject.CreateInstance <WorldPropertyScriptable>();

            scriptable.FromRuntimeProperty(property, true);

            AssetDatabase.CreateAsset(scriptable, string.Format("{0}/{1}", WorldPropertyPath, fileName));

            NarrativeDictionary.GetAsset().AddWorldProperty(scriptable);
            return(true);
        }