Clan System error

General support.
Post Reply
User avatar
Bondarius
Contributor
Contributor
Posts: 11
Joined: Fri Apr 10, 2020 2:19 am

Hi! I am using MFPS 1.7.

Clan version is - 1.1.5.

So my problem is the following :
I integrated the system, it works well. However after creating a clan, If anyone selects "My Clan" Button. The menu just keeps on loading and nothing happens.

Reason behind it is this error message:

NullReferenceException: Object reference not set to an instance of an object
bl_ClanInfo.PlayerRole () (at Assets/Addons/ClanSystem/Content/Scripts/Core/bl_ClanInfo.cs:28)
bl_MyClan.DecompileSettings (System.String line) (at Assets/Addons/ClanSystem/Content/Scripts/Core/bl_MyClan.cs:182)
bl_MyClan+<GetUserClan>d__29.MoveNext () (at Assets/Addons/ClanSystem/Content/Scripts/Core/bl_MyClan.cs:126)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)

Any ideas what needs to be done?
User avatar
Lovatto
Admin
Admin
Posts: 1778
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Try replacing the following property:
in the script bl_ClanInfo.cs -> replace the property 'PlayerRole()' with this:

Code: Select all

 public ClanMemberRole PlayerRole()
    {
        if(Members.Count > 0 && bl_DataBase.Instance.LocalUser != null)
        {
            var member = Members.Find(x => x.ID == bl_DataBase.Instance.LocalUser.ID);
            if(member != null)
            return member.Role;
        }
        return ClanMemberRole.Member;
    }
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
Bondarius
Contributor
Contributor
Posts: 11
Joined: Fri Apr 10, 2020 2:19 am

Now I receive this:

NullReferenceException: Object reference not set to an instance of an object
bl_MyClan+<GetClanMembers>d__33.MoveNext () (at Assets/Addons/ClanSystem/Content/Scripts/Core/bl_MyClan.cs:212)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
User avatar
Bondarius
Contributor
Contributor
Posts: 11
Joined: Fri Apr 10, 2020 2:19 am

Any update on this one?
User avatar
Lovatto
Admin
Admin
Posts: 1778
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

I can't replicate the error on my side, but due to the error stack trace that you show me, it indicates that one of the members was added or removed from the clan manually, or probably you update from an older version of ULogin Pro.

Anyway, try the following:
in the script bl_MyClan.cs -> replace the coroutine GetClanMembers() with this:

Code: Select all

IEnumerator GetClanMembers()
    {
        WWWForm wf = new WWWForm();
        wf.AddField("type", 2);
        wf.AddField("hash", bl_DataBase.Instance.GetUserToken());
        wf.AddField("clanID", bl_ClanManager.Instance.ClanInfo.ID);
        using (UnityWebRequest w = UnityWebRequest.Post(bl_LoginProDataBase.Instance.GetUrl(bl_LoginProDataBase.URLType.Clans), wf))
        {
            yield return w.SendWebRequest();

            if (!w.isNetworkError)
            {
                string t = w.downloadHandler.text;
                string[] split = t.Split("-"[0]);
                for (int i = 0; i < split.Length; i++)
                {
                    if (string.IsNullOrEmpty(split[i])) continue;
                    string[] info = split[i].Split("|"[0]);
                    if (string.IsNullOrEmpty(info[0])) continue;

                    int id = int.Parse(info[0]);
                    var member = bl_ClanManager.Instance.ClanInfo.Members.Find(x => x.ID == id);
                    if (member != null)
                    {
                        member.Name = info[1];
                    }
                    else
                    {
                        bl_ClanManager.Instance.ClanInfo.Members.Add(new bl_ClanInfo.ClanMember()
                        {
                            Name = info[1],
                            ID = id,
                            Role = ClanMemberRole.Member,
                        });
                    }
                }
                InstanceMembers();
                StartCoroutine(GetRequests());
                DisplayInfo();
            }
            else
            {
                Debug.LogError(w.error);
            }
        }
    }
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
Bondarius
Contributor
Contributor
Posts: 11
Joined: Fri Apr 10, 2020 2:19 am

Thank you :) It's fixed
Post Reply