摘要: [添加脚本(Move)] //该脚本挂在img的父物体上 using UnityEngine;using System.Collections;using UnityEngine.UI; //定义枚举 public enum Tools{ 空, 塞尺} public class Move : Mon 阅读全文
posted @ 2016-07-01 12:56 CocomoNo1 阅读(377) 评论(0) 推荐(0) 编辑
摘要: 一:(碰撞体)触发信息检测: 发生碰撞的两个物体应满足的条件: NO1:两物体都应该有碰撞体 NO2:其中一个带刚体; NO3:检测触发信息的脚本需绑定在带刚体的物体上 1.MonoBehaviour.OnCollisionEnter( Collision collisionInfo ) 当进入碰撞 阅读全文
posted @ 2016-07-01 09:52 CocomoNo1 阅读(515) 评论(0) 推荐(0) 编辑
摘要: Event System 组成 系统生成的Event System里面主要有两个Components,分别是Event System和Standalone Input Module。其中Standalone Input Module是派生自BaseInputModule。 作用 1. EventSy 阅读全文
posted @ 2016-07-01 09:31 CocomoNo1 阅读(290) 评论(0) 推荐(0) 编辑
摘要: using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [RequireComponent(typeof(Image))] public class DragMe : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {... 阅读全文
posted @ 2016-07-01 09:27 CocomoNo1 阅读(680) 评论(0) 推荐(1) 编辑
摘要: Transform 变换 Namespace: UnityEngine Inherits from: Component Namespace: UnityEngine Inherits from: Component Description 描述 Position, rotation and sca 阅读全文
posted @ 2016-07-01 09:00 CocomoNo1 阅读(258) 评论(0) 推荐(0) 编辑
摘要: using UnityEngine;using System.Collections;using UnityEngine.UI; public class MouseFollow : MonoBehaviour { Canvas canvas;//跟随范围为整个画布 RectTransform re 阅读全文
posted @ 2016-06-30 17:20 CocomoNo1 阅读(259) 评论(0) 推荐(0) 编辑
摘要: using UnityEngine;using System.Collections;using UnityEngine.UI;using System.Collections.Generic;public class SizeCompute : MonoBehaviour{ public Text 阅读全文
posted @ 2016-06-30 13:53 CocomoNo1 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1. C#里使用Find函数查找物体时要用 GameObject:GameObject.Find("Canvas/Text").GetComponent<Text>().text="Score";2. 用Instantiate初始化物体时要用 as Transform 转换类型(对于 Transfo 阅读全文
posted @ 2016-06-30 12:42 CocomoNo1 阅读(449) 评论(0) 推荐(0) 编辑
摘要: using UnityEngine;using System.Collections; public class LookForPath : MonoBehaviour{ public Transform target;//开始位置(移动对象的位置) public Transform[] Targe 阅读全文
posted @ 2016-06-30 11:33 CocomoNo1 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 假设两个分别为A和B,分别挂有脚本AScript和BScript,现在想让BScript调用(A的脚本)AScript中的FollowMe()函数。 using UnityEngine;using System.Collections; public class BScript : MonoBeha 阅读全文
posted @ 2016-06-30 10:47 CocomoNo1 阅读(8832) 评论(0) 推荐(0) 编辑