示例#1
0
    IEnumerator asd(VarInt a)
    {
        //a.Retain();

        yield return(new WaitForSeconds(2f));

        //Debug.LogError("a=" + a.Value);

        //Debug.Log("在携程中释放");
        a.Release();
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            Variable <int[]> a = GameEntry.Pool.DequeueVarObject <Variable <int[]> >();
            a.Value = new int[2] {
                112, 2
            };
            a.Retain();

            GameEntry.Event.CommonEvent.Dispatch(CommonEventId.RegComplete, a);
            a.Release();
            Debug.Log(a.ReferenceCount);
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            VarInt s = VarInt.Alloc(111);

            GameEntry.Event.CommonEvent.Dispatch(1002, s);
            s.Release();
            Debug.Log(s.ReferenceCount);
        }
    }
    private IEnumerator ReleaseVar(VarInt a)
    {
        yield return(new WaitForSeconds(5));

        a.Release();
    }