【发布时间】:2016-08-10 07:27:36
【问题描述】:
嗨,我是新人,所以这是我的代码:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
var pos = transform.position;
pos.x += 1;
transform.position = pos;
string ss = "hellow";
if(pos>100){
print (ss);
}
}
}
但是在 if 条件行中给我这个错误:无法将 int 类型隐式转换为 unityengine.vector3'
【问题讨论】:
-
嗯,是的 - 你认为
pos > 100是什么意思?pos是一个位置,一个Vector3...位置大于100是什么意思? -
try this:if (pos.x > 100) {...}