using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Vector3_example : MonoBehaviour
{
Vector3 myVector3 = new Vector3(0.0f, 3.0f, 4.0f);
void Start()
{
print(myVector3.x); // 0.0
print(myVector3.y); // 3.0
print(myVector3.z); // 4.0
print(myVector3.magnitude); // 5.0
// myVector3.Normalize(); // [0.0 0.6 0.8]
// sets the magnitude to 1
//print(myVector3);
print(myVector3.Normalize());
}
void Update()
{
}
}
【报错】error CS1503: Argument 1: cannot convert from ‘void’ to ‘object’
解决
print(myVector3.Normalize());
改成
myVector3.Normalize();
print(myVector3);
不知道为啥,void方法没有返回值吧