我在联合2017年上了一堂课,只展示了巡查员的一些公共方法。
using System.Collections.Generic;
using UnityEngine;
public class Inventory : MonoBehaviour
{
List<ShipPart> _inventory;
int currentInvPosition = 0;
bool invExists = false;
// Use this for initialization
void Start () {
CreateInventory(0, 0);
}
// Show all inventory parts as gameobjects
public void CreateInventory(int quality, int part)
{
...
}
void DestroyInventory()
{
...
}
public void ScrollInvLeft()
{
...
}
public void ScrollInvRight()
{
...
}
void UpdateInv(float offset)
{
...
}
public void AddInventoryItem(ShipPart newShipPart)
{
...
}
public void RemoveInventoryItem(ShipPart oldShipPart)
{
...
}
public void Test1(){}
public void Test2(int i){}
}我认为这可能是因为无形的方法有参数,所以我添加了最后两个方法。不管他们在巡查员那里是什么样子!
我试图从下拉UI元素中调用这些方法,但也从一个按钮进行了测试,这也无法看到它们。

我做错了什么?
发布于 2018-05-02 10:48:08
如官方统一教程中所示,如果要向检查器中的事件提供函数,则该函数必须满足以下要求:
publicvoid的返回类型。intfloatstringboolUnityEngine.Object,或从UnityEngine.Object继承的任何类型(如GameObject、MonoBehaviour、ScriptableObject、.)
https://stackoverflow.com/questions/50131837
复制相似问题