- Изменено
Setting Atlas Materials to Instances in Runtime
Hi,
First of all sorry if this is a duplicate thread but I've googled around everywhere and I feel like I can't find an answer to this anywhere.
I'm trying to make a system for a 2D mmorpg, that handles the gear that the players have and displays them on their characters, but I'm having trouble when multiple characters are on the screen seeing as they use the same atlas/skeleton files since they're all humanoids.
So basically what I want to do is create an Atlas Asset Base in runtime to fill with materials that I have instanced previously and then assign that Atlas Asset Base to my skeleton (the base would copy from a "template" which is the same as the one the skeleton already had and was working with) so that every player can have their own character looking like what they want.
I've tried using the built in constructor to create a Spine Atlas Asset in runtime and while that does create a file that looks exactly like what I want, when I go to assign the file to the skeleton it says the type is miss matched.
I've also tried other methods of instancing a copy of the Atlas Asset Base in runtime but due to the nature of the class I can't edit the list of materials which renders it useless to my purposes.
I haven't tried using skins but currently I'm using skins to handle the atlas used based on where the player is facing so I feel like it would be more work to use skins.
Any suggestions are appreciated, thanks for the help in advance.
MiguelACAlmeida написалI've tried using the built in constructor to create a Spine Atlas Asset in runtime and while that does create a file that looks exactly like what I want, when I go to assign the file to the skeleton it says the type is miss matched.
By "built in constructor" do you mean you really called the constructor of the class? Please note that this is in general not recommended in Unity to use the constructor directly to create a ScriptableObject
instance, see here instead:
https://docs.unity3d.com/ScriptReference/ScriptableObject.CreateInstance.html
Apart from that, why are you not using any of the SpineAtlasAsset.CreateRuntimeInstance
methods?