C#脚本无法挂载
请注意该段脚本代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RubyContrall : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
脚本命名如下
在脚本中调用的文件名应与脚本创建的名称相同,如此Unity才支持添加
结果如下
而一般情况下脚本的代码如下
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
由于未更改调用名而导致失败