相关网盘免费资源下载...
1. unity中在js中调用C#的脚本时,js的名空间#pragma strict要去掉,否则js不能调用c#中的脚本:
#pragma strict可以更加严格的进行静态类型检查,能够引导你更加好的写更加严谨和更好风格的代码,一般在开发的时候推荐写上。
2. 要使用Physics.Raycast ()来检测鼠标点击所获取的物体时,该物体object必须有碰撞器组件!否则Raycast ()检测不到!
Physics.Raycast ()static function Raycast (origin : Vector3, direction : Vector3, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : boolean Returnsboolean - True when the ray intersects any collider, otherwise false.//布尔值,如果射线相交于任一碰撞器,返回true 否则为falseDescription //描述Casts a ray against all colliders in the scene.// 对场景里的所有带有碰撞器组件的对象投放一束射线