I got this piece of code in an Editor script:
It’s supposed to create and modify and asset of Type LootTable.
It runs with no errors, it creates the asset with the desired name in the desired place, but all attributes in the asset are those of the defaultLootTable.
I assume that something goes wrong with saving. I suppose my saving command is wrong. How do I fix it?
Thanks!
Here’s my go-to example of creating (or modifying) a ScriptableObject and telling Unity to save it:
/*
The following license supersedes all notices in the source code.
Copyright (c) 2019 Kurt Dekker/PLBM Games All rights reserved.
http://www.twitter.com/kurtdekker
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the Kurt Dekker/PLBM Games nor the names of its
contributors may be used to endorse or promote products derived from
This file has been truncated. show original
Look around line 266 onwards, the block of code that writes the DatasackCollection type to a disk asset.