#How should I use the 'IStaminaModifier' to give the player unlimited stamina?

1 messages · Page 1 of 1 (latest)

steady grail
#

Here's my code example (roughly) and it's confusing that the code is able to work perfectly fine on my machine, but the problem arises on a remote server. What's even more perplexing is that the same event(In other class) it may work normally or it may not work

safe jolt
#
internal static void Initialize()
    {
        // wait for scene to load to make sure prefab is loaded
        SceneManager.sceneLoaded += Load;
    }

    private static void Load(Scene scene, LoadSceneMode mode)
    {
        SceneManager.sceneLoaded -= Load;

        Transform playerEffects = NetworkManager.singleton.playerPrefab.GetComponent<PlayerEffectsController>().effectsGameObject.transform;
        foreach (Type type in Constants.Types)
        {
            if (type.IsAbstract)
                continue;

            if (!type.IsSubclassOf(typeof(CustomPlayerEffect)))
                continue;

            // register effect into prefab
            new GameObject(type.Name, type).transform.parent = playerEffects;
        }
    }

this is currently how i handle it another repo

#

apply it to NetworkManager.singleton.playerPrefab with the effects and then you dont need to do it on every player join

steady grail
safe jolt
#

I cant tell you for sure, but it works for me without issue

#

well did, i havent tested on latest update

steady grail
#

I will try it

#

thanks

safe jolt
#

@steady grail Did this fix it?

steady grail
steady grail