我试图Object在Unity中移动一个简单但我收到以下错误消息:
cannot modify the return value of unityengine.transform.position because itar is not variable
这是我的代码:
using UnityEngine;
using System.Collections;
public class walk : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float movespeed = 0.0f;
movespeed++;
transform.position.x = transform.position.x + movespeed;
}
}
Run Code Online (Sandbox Code Playgroud) 我试图在Unity环境中调用一个用c#编写的示例函数.我收到此错误消息:
多成员名称不能与其封闭类型相同
这是我正在使用的代码:
using UnityEngine;
using System.Collections;
public class multi : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
int x = 5;
multi (x);
}
int multi ( int tem ){
int ret ;
ret = tem * 2 ;
return ret;
}
}
Run Code Online (Sandbox Code Playgroud)