30 lines
578 B
C#
30 lines
578 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using NUnit.Framework;
|
||
|
using UnityEngine;
|
||
|
using System.Text;
|
||
|
using UnityEngine.TestTools;
|
||
|
using System.Linq;
|
||
|
namespace BITKit
|
||
|
{
|
||
|
public class PointerTest
|
||
|
{
|
||
|
public object value;
|
||
|
[Test]
|
||
|
public void MakeRefAndRefValue()
|
||
|
{
|
||
|
value = 64;
|
||
|
|
||
|
var typedReference = __makeref(value);
|
||
|
|
||
|
var field = typeof(PointerTest).GetField("value");
|
||
|
|
||
|
field.SetValueDirect(typedReference,128);
|
||
|
|
||
|
__refvalue(typedReference,object) = 128;
|
||
|
|
||
|
Debug.Log("预期值:128,实际值:"+value);
|
||
|
}
|
||
|
}
|
||
|
}
|