Texture.GetInstance C# (CSharp) Method

GetInstance() public static method

public static GetInstance ( ) : Texture,
return Texture,
    public static Texture GetInstance()
    {
        if (applicationIsQuitting) {
            App42Log.Console ("[Singleton] Instance already destroyed on application quit." +
                              " Won't create again - returning null.");
            return null;
        }
        lock (lockString) {
            if (restCon == null) {
                App42Log.Console (" GetInstance Null ");
                GameObject gameObj = new GameObject ("Texture");
                restCon = gameObj.AddComponent<Texture> ();
                DontDestroyOnLoad (gameObj);
                return restCon;
            } else {
                App42Log.Console (" GetInstance Not Null ");
                return restCon;
            }
        }
    }

Usage Example

    //public static string fbAccessToken = "";

    public void OnSuccess(object response)
    {
        if (response is Game)
        {
            Game gameObj = (Game)response;
            Debug.Log("Game ::: " + gameObj.ToString());
            if (gameObj.GetScoreList().Count > 0)
            {
                for (int i = 0; i < gameObj.GetScoreList().Count; i++)
                {
                    string name       = gameObj.GetScoreList()[i].GetFacebookProfile().GetName();
                    string score      = gameObj.GetScoreList()[i].GetValue().ToString();
                    string profilePic = gameObj.GetScoreList()[i].GetFacebookProfile().GetPicture();
                    string userId     = gameObj.GetScoreList()[i].GetFacebookProfile().GetName();

                    Texture.GetInstance().ExecuteShow(userId, profilePic);

                    IList <string> slist1 = new List <string>();
                    slist1.Add(userId);
                    slist1.Add(name);
                    slist1.Add(profilePic);
                    slist1.Add(score);
                    friendList.Add(slist1);
                }
            }
        }
    }
All Usage Examples Of Texture::GetInstance