摘要:
Dynamic Texture2D in UnityUICreate Texture2D and assign image to it through a script//需要在最上级Asset folder下建一个Resources folder,然后里面放要dynamic attach的textureusing UnityEngine;using System.Collections;public class TearApartControl : MonoBehaviour { public Texture2D handCursor; // Use this for initi... 阅读全文
摘要:
Customise mousehover cursorCustom Mouse CursorMouse over change texture项目中我用的方法using UnityEngine;using System.Collections;public class TearApartControl : MonoBehaviour { public Texture2D handCursor; private bool _hitOBject = false; // Use this for initialization void Start () { { ... 阅读全文
摘要:
Get children gameobjects arrayGet references to all gameobjects that are tagged with a particular tag?Sort an ArrayList of game objects...GameObject assetBundle = GameObject.FindGameObjectWithTag("main"); //找到parent gameobjectTransform[] parts = assetBundle.GetComponentsInChildren<Trans 阅读全文
摘要:
使用enum propertyBOM2 项目中需要有一个单独的script控制mode的切换,其他scipt根据这个mode切换到哪一个enum来决定该mode下的一些功能的开启。一开 始我用的是inspector的方法,在enum的script里控制enum选择的值,然后在需要做判断的script里创建一个public变量来接 受enum值的变化。后来我改为完全用类的enum方法实现。//ModeSelector.csusing UnityEngine;using System.Collections; public enum ModeEnum { Assembly... 阅读全文