大神,有个关于脚本的调用的问题,请教下:脚本1:public class script1 : MonoBehaviour { // Use this for initialization public string npcname=””; // Update is called once per frame void Update () { if(Input.GetMouseButtonDown(0)) { Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray,out hit)) { GameObject obj=hit.collider.gameObject; npcname=obj.name; Debug.Log(npcname); } } }}脚本2(调用脚本1里npcname参数):public class script2 : MonoBehaviour { // Use this for initialization script1 sp1; task_script task; string levelname=””; string npc=””; ArrayList list=new ArrayList(); void Start () { sp1=GameObject.Find(“Sphere”).GetComponent(); task=GameObject.Find(“task”).GetComponent(); //获得脚本3 levelname=Application.loadedLevelName; //获得当前场景名 npc=sp1.npcname; //接收脚本1里npcname值 } // Update is called once per frame void OnMouseDown () { list=(ArrayList)task.task_create(npc); for(int i=0;i
额,貌似没放下,直接说问题吧。在脚本调用中,出现“NullReferenceException: Object reference not set to an instance of an objectscript2.Start () (at Assets/script2.cs:16)”错误提示了,我想问,string类型参数,怎么进行实例化?
请问一下,哪里有unity3D中C#教程?
雨松老师,又来请教你一个问题,请问你用过unity 的GPS定位功能LocationService 和 LocationInfo,我测试的是安卓平台,一些手机可以定位成功,一些手机一直在初始化中,我定位服务都开启了,不知道是什么原因,还有就是有常用的第三方定位的SDK呢?
请教momo大神,unity for iOS app 能内嵌到iOS app中吗?实现native app启动unity,混合应用。
请教下,这是我写的一个从本地文件夹读取图片然后动态加载到场景里的方法,这个loadImage为什么这么吃内存,100MB的图用这个加载后内存直接飙到1.6GB,求解答filePath=”F:/NoJM/_PS/4″; if(!System.IO.Directory.Exists(filePath)){ Debug.Log(“???????????????”); }else{ System.IO.DirectoryInfo dic=new System.IO.DirectoryInfo(filePath); int j=System.IO.Directory.GetFiles(filePath).Length; for(int i=0;i().mainTexture= alo; btn_pics.Add(clone); alo=null; fs.Close(); } grid.GetComponent().Reposition(); }
MO神,在做射线碰撞时出了点问题,2个物体都可以移动,由一个物体发射射线,但因为物体可移动,发生了相对坐标的偏移,导致射线出了问题,求解决方法,最好写点主代码,谢谢!
MO神,在实际开发中,控制人物运动,比如向前走,向后走,左旋转,右旋转,跳跃,降落等。是用unity里自带角色控制器里的CharacterMotor呢,还是自己写?
请教MOMO大神,我在场景中建一个BoxCollider触发器,用OnMouseDown()函数点击是可以响应鼠标事件的,但是我给BoxCollider加一个空的父节点,再在父节点上加个刚体就不可以触发了,这是什么原因啊?
雨松大哥,姑且这样称呼您一下吧!有时间出一本NGUI的书吧,最好把NGUI的原理能分析一下,因为它的最核心的原代码始终都不放出来,到时一定买!
大神,有个关于脚本的调用的问题,请教下:脚本1:public class script1 : MonoBehaviour { // Use this for initialization public string npcname=””; // Update is called once per frame void Update () { if(Input.GetMouseButtonDown(0)) { Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray,out hit)) { GameObject obj=hit.collider.gameObject; npcname=obj.name; Debug.Log(npcname); } } }}脚本2(调用脚本1里npcname参数):public class script2 : MonoBehaviour { // Use this for initialization script1 sp1; task_script task; string levelname=””; string npc=””; ArrayList list=new ArrayList(); void Start () { sp1=GameObject.Find(“Sphere”).GetComponent(); task=GameObject.Find(“task”).GetComponent(); //获得脚本3 levelname=Application.loadedLevelName; //获得当前场景名 npc=sp1.npcname; //接收脚本1里npcname值 } // Update is called once per frame void OnMouseDown () { list=(ArrayList)task.task_create(npc); for(int i=0;i
额,貌似没放下,直接说问题吧。在脚本调用中,出现“NullReferenceException: Object reference not set to an instance of an objectscript2.Start () (at Assets/script2.cs:16)”错误提示了,我想问,string类型参数,怎么进行实例化?
momo大大 我游戏打包后 Android 和 ios 以及pc的出错报告生成的目录分别在哪?还是要自己写一个本地记录方法?
关于“unity3D游戏开发”这本书,有个地方不理解,第九章,多媒体与网络,9.4,-简单的网络游戏,我按书里的代码写了,然后开2个客户端,连接服务器没有问题,聊天也没有问题(就是不能自动刷新消息),移动物体也没有问题,问题是两个客户端相互看不到。是不是我的脚本放置的地方有问题呢,我都是放在摄像机上,服务器端的模型都删掉了,只留有几个UI显示客户端发送的消息,然后在客户端添加了模型。
你好 请问 我现在在一个strolview里实现了按下上下左右键里面的按钮就能获取焦点 但是在继续按下右键的时候不能自动的滑动 那该怎么解决
void OnGUI() { if(GUI.RepeatButton(new Rect(200,500,150,100),”向左”)|| Input.GetKey(KeyCode.A)) { target.transform.RotateAround(center.transform.position,Vector3.up, -2 * speed); } if(GUI.RepeatButton(new Rect(674,500,150,100),”向右”)|| Input.GetKey(KeyCode.D)) { target.transform.RotateAround(center.transform.position,Vector3.up, 2 * speed); } if(GUI.RepeatButton(new Rect(437,334,150,100),”向上”)|| Input.GetKey(KeyCode.W)) { target.transform.RotateAround(center.transform.position,Vector3.right, -2 * speed); } if(GUI.RepeatButton(new Rect(437,700,150,100),”向下”)|| Input.GetKey(KeyCode.S)) { target.transform.RotateAround(center.transform.position,Vector3.right, 2 * speed); } } }站长我这个代码使用你的高尔夫游戏改的, 运行时按上下左右都没问题 但是左或者右到45°的时候 再按上下键 旋转就十分不自然 是哪里有问题呢?
站长 如何在ios上用虚拟按钮控制 摄像机转动?
站长,,unity web play 有没有办法自动安装在电脑上
大神 高通AR模型晃动 怎么解决呢
什么意思? 怎么晃动的?
就是用高通AR 中,我扫一张图片出来一个cube 那个cube老是在细微的晃动
大神 你unity游戏里分享的博客在哪里找呢写插件的方式我就不再说了,如果不懂的朋友看我之前的博客吧,写的很清楚。
站长,你的著作《unity3d 游戏开发》的游戏资源在哪里可以下载啊?我自己买了一本这书来学习,但是里面很多资源都没有交代出处,自己去弄的话学习周期又太长了,能不能告知一下?
https://www.xuanyusong.com/archives/1435
嗯,嗯,万分感谢
站长,你的Unity拓展编辑器没有放到UNITY频道的菜单里面,希望多点写编辑器的记录笔记,编辑器跟shadow是我最想学好的unity技术
歌很好听
呵呵。。
歌好对胃口
谢谢哈。。