decoamorim

Hello guys,

I am getting an issue when trying to change skins here.

The same code that i am using to null some slots, which is working, but when i try to change skins i get a null reference.
The name of the skin is correct, i get the error with the default skin as well.
SkeletonRenderer skeletoRenderer;
string playerSkin = "igorCruz";
void Awake(){

skeletoRenderer = GetComponent<SkeletonRenderer>();

SkinSelected();
}
void SkinSelected()
{
//SKIN IGOR
if (playerSkin == "igorCruz")
{
skeletoRenderer.skeleton.SetSkin("igorCruz");

}
This line works for slots :
skeletoRenderer.skeleton.SetAttachment("gloveStandardFSlot", null);

If someone know what i am doing wrong i ll be happy to learn! :)

thanks!
Developer/Founder at DCF Studios
http://www.studiosdcf.com/
Author of
Cruz Brothers[PS4 / STEAM] [upcoming on XboxOne] - http://www.cruzbrothersgame.com
Bunny Battle Arena[STEAM] - https://store.steampowered.com/app/872340/Bunny_Battle_Arena/
Avatar
decoamorim
  • Postovi: 131

Pharan

You need to do it in Start. The skeleton isn't guaranteed to exist in Awake because the Skeleton object is generated in Awake.

Also, next time, please paste and check the error log and stacktrace so we know where the null reference is.
Avatar
Pharan
  • Postovi: 5366

decoamorim

Oh... that was it, thanks!

Next time i ll paste the log!
Developer/Founder at DCF Studios
http://www.studiosdcf.com/
Author of
Cruz Brothers[PS4 / STEAM] [upcoming on XboxOne] - http://www.cruzbrothersgame.com
Bunny Battle Arena[STEAM] - https://store.steampowered.com/app/872340/Bunny_Battle_Arena/
Avatar
decoamorim
  • Postovi: 131


Natrag na Unity