Popcorn-Factory / Arsonist-RoR2

Arsonist, The Manic Incendiary, a custom survivor in RoR2
1 stars 2 forks source link

ArsonistController.Start() can sometimes fail causing NullRefs in EnergySystem.Update(). #15

Closed WolfoIsBestWolf closed 5 months ago

WolfoIsBestWolf commented 5 months ago

I can't replicate this issue with the respawn command or Dios only with a delayed respawn I use in my mods, but I feel if my mods break it and what I do is fine for every other character I've encountered then maybe it's more an issue here since other mods might break it too.

Also I'm pretty sure this can easily break with latency but cant test that.

I suggest changing :

        ChildLocator childLocator = GetComponentInChildren<ChildLocator>();
        if(childLocator != null)
        { 

to

        ChildLocator childLocator = GetComponentInChildren<ChildLocator>();
        if(childLocator == null)
        { 
        childLocator = GetComponent<ModelLocator>().modelTransform.GetComponent<ChildLocator>();
    }       
    if(childLocator != null)
        { 

as a additional safety check

Ethanol10 commented 5 months ago

Man that's wack. I'll try out that fix

Ethanol10 commented 5 months ago

changed to pull from modeltransform instead of finding component in children.