C#C
C#4y ago
izzint

Public Static Variable Not Updating in other scripts

in script A, I define a variable public static string fooC;, I update it in a function,
       // this script is called "A"
        public override void OnSceneWasLoaded(int buildIndex, string sceneName)
        {
            // LoggerInstance.Msg(sceneName);

            fooC = sceneName;
                  
            // for whatever reason this is what i want it to be.
            LoggerInstance.Msg(RPCname);


                                                           // this calls the stored
            discManage.GetActivityManager().UpdateActivity(fooB.RPCloader, (result) =>
            {
               
                if (result == Discord.Result.Ok)
                {
                    LoggerInstance.Msg("BLRP Loaded!");
                    
                }
                else
                {
                    LoggerInstance.Error("Error Loading BLRP");
                }
            });

        }


and then I try to access it in another script,

    public static class fooB
    {
        public static Discord.Activity RPCloader = new Discord.Activity
        {
            State = fooA.FooC,

            Timestamps =
                {
                    Start = 4
                },

            Assets =
                {
                    LargeImage = "loadinglarge",
                    SmallImage = "smalloading"

                },

            
        };


but the variable is just at the default "RPCname", im sorry if this is really bad formating, im new to asking with help, and i can't find anything on google to help me. I don't know if this breaks OOP or not
Was this page helpful?