C#中指针的使用
using UnityEngine;
using System.Collections;
public class TestRef : MonoBehaviour {
private FindCatGame testObject;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.P)){
if(testObject==null){
testObject=gameObject.GetComponent<FindCatGame>();
}
ChangeRefFloat(ref testObject.finishedMissionID);
}
}
private void ChangeRefFloat(ref int value){
value-=1;
}
}