why i am getting this here
can anyone help? ty
using UnityEngine;
using UnityEditor;
using System.IO;
public class UserViewer : EditorWindow {
[MenuItem("Window/UserViewer")]
public static void OpenEditor()
{
GetWindow<UserViewer>("UserViewer", true);
}
[SerializeField]
private UsersData usersData = null;
[SerializeField]
private int numberOfUsers;
[SerializeField]
private int numberOfUsersToShow;
[SerializeField]
private int id;
[SerializeField]
private int index;
[SerializeField]
private string[] acountNames;
[SerializeField]
private string activeAcountInfo;
[SerializeField]
private static bool _isUserInfoDone = false;
void OnGUI()
{
if(usersData == null)
{
Init();
}
else
{
if (_isUserInfoDone == false)
{
GetUserInfos();
_isUserInfoDone = true;
}
MakeUserSelection();
if (GUILayout.Button("Show Selected User"))
{
DisplayUsers(numberOfUsersToShow);
}
if (GUILayout.Button("Close"))
Close();
if (GUI.changed)
EditorUtility.SetDirty(usersData);
}
}
public void MakeUserSelection()
{
EditorGUILayout.LabelField("User Selection");
numberOfUsers = usersData.userInfos.Count;
EditorGUILayout.TextField("Total Users Count", numberOfUsers.ToString());
index = EditorGUILayout.Popup(index, acountNames);
numberOfUsersToShow = index;
EditorGUILayout.LabelField("Acount Info");
activeAcountInfo = EditorGUILayout.TextField(usersData.userInfos[numberOfUsersToShow].userRFirstName + " - " + usersData.userInfos[numberOfUsersToShow].userRLastName + " Email :" + usersData.userInfos[numberOfUsersToShow].userEmail + " Coins :" + usersData.userInfos[numberOfUsersToShow].userCoins);
}
public void Init()
{
usersData = ScriptableObject.CreateInstance<UsersData>();
if (!Directory.Exists(Application.dataPath + Path.DirectorySeparatorChar + "Resources"))
AssetDatabase.CreateFolder("Assets", "Resources");
if(File.Exists(Application.dataPath + Path.DirectorySeparatorChar + "Resources" + Path.DirectorySeparatorChar + "Users.asset"))
{
usersData = AssetDatabase.LoadAssetAtPath("Assets/Resources/Users.asset", typeof(UsersData)) as UsersData;
}
else
{
AssetDatabase.CreateAsset(usersData, "Assets/Resources/Users.asset");
AssetDatabase.SaveAssets();
}
}
void GetUserInfos()
{
acountNames = new string[numberOfUsers];
for (int i = 0; i < numberOfUsers; i++)
{
acountNames = usersData.userInfos.userID.ToString() + " : " + usersData.userInfos.userAlias;
}
}
public void DisplayUsers(int i)
{
EditorGUILayout.BeginVertical();
index = EditorGUILayout.Popup(index, acountNames);
numberOfUsersToShow = index;
usersData.userInfos.userAlias = EditorGUILayout.TextField("User Acount Name", usersData.userInfos.userAlias);
usersData.userInfos.userAvatar = (Texture2D)EditorGUILayout.ObjectField("Avatar", usersData.userInfos.userAvatar, typeof(Texture2D), false);
EditorGUILayout.LabelField("Color");
usersData.userInfos.userColor = EditorGUILayout.ColorField(usersData.userInfos.userColor);
EditorGUILayout.LabelField("Coins");
usersData.userInfos.userCoins = EditorGUILayout.IntField(usersData.userInfos.userCoins);
EditorGUILayout.LabelField("Acount is Active");
usersData.userInfos.userActive = EditorGUILayout.Toggle(usersData.userInfos.userActive);
EditorGUILayout.LabelField("Rank");
usersData.userInfos.userRank = EditorGUILayout.IntField(usersData.userInfos.userRank);
EditorGUILayout.LabelField("Real Balance");
usersData.userInfos.userBalance = EditorGUILayout.FloatField(usersData.userInfos.userBalance);
EditorGUILayout.LabelField("User Details");
usersData.userInfos.userRFirstName = EditorGUILayout.TextField("First Name", usersData.userInfos.userRFirstName);
usersData.userInfos.userRMiddleName = EditorGUILayout.TextField("Middle Name", usersData.userInfos.userRMiddleName);
usersData.userInfos.userRLastName = EditorGUILayout.TextField("Last Name", usersData.userInfos.userRLastName);
usersData.userInfos.userAddress1 = EditorGUILayout.TextField("Address 1", usersData.userInfos.userAddress1);
usersData.userInfos.userAddress2 = EditorGUILayout.TextField("Address 2", usersData.userInfos.userAddress2);
usersData.userInfos.userCity = EditorGUILayout.TextField("City", usersData.userInfos.userCity);
usersData.userInfos.userState = EditorGUILayout.TextField("State", usersData.userInfos.userState);
usersData.userInfos.userCountry = EditorGUILayout.TextField("Country", usersData.userInfos.userCountry);
usersData.userInfos.userPostalCode = EditorGUILayout.TextField("Postal Code", usersData.userInfos.userPostalCode);
usersData.userInfos.userEmail = EditorGUILayout.TextField("Email", usersData.userInfos.userEmail);
usersData.userInfos.userPhoneNumber = EditorGUILayout.TextField("Phone Number +", usersData.userInfos.userPhoneNumber);
EditorGUILayout.EndVertical();
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Internal Account Info");
usersData.userInfos.isUserActiveNow = EditorGUILayout.Toggle("User Active Now ",usersData.userInfos[i].isUserActiveNow);
usersData.userInfos[i].isUserAuth = EditorGUILayout.Toggle("User Auth Now", usersData.userInfos[i].isUserAuth);
usersData.userInfos[i].isUserPremium = EditorGUILayout.Toggle("User Premium", usersData.userInfos[i].isUserPremium);
usersData.userInfos[i].isUserPrivate = EditorGUILayout.Toggle("User Private", usersData.userInfos[i].isUserPrivate);
usersData.userInfos[i].isUserAccAth = EditorGUILayout.Toggle("User Account Auth", usersData.userInfos[i].isUserAccAth);
EditorGUILayout.EndHorizontal();
if (GUI.changed)
{
EditorUtility.SetDirty(usersData);
}
GUI.SetNextControlName("");
}
}