2013年10月1日 星期二

UNITY 3D 小小MEMO

取得子物件的component

var script : hitEffectPlanePrefabScript; 
script = hitEffect2.GetComponentInChildren(hitEffectPlanePrefabScript);
script.deadTogether ();

===================================
建立clone物件

var XXXXX:GameObject = Instantiate(YYYYY,Vector3(this.transform.position.x,1,this.transform.position.z),Quaternion.identity);

GameObject creatMenuButton = Instantiate(menuButtonnew Vector3(0,0,0), Quaternion.identityas GameObject;
===================================
mono快速注解
Toggle Line Comments

===================================
使用方向鍵控制物體移動

void Update () {
//Vertical 垂直
var input = Input.GetAxis("Vertical");
transform.Translate(0,input,0);
//Horizontal 水平
var input2 = Input.GetAxis("Horizontal");
transform.Translate(input2,0,0);

}

//GetAxis 移動時有遞增及遞減效果
//GetAxisRaw 無遞增遞減效果

===================================
副執行序
StartCoroutine(start());


IEnumerator start()
{

}

===================================
像螢幕發射子彈
    void Update () {
        if ( Input.GetMouseButtonDown(0))
        {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            Debug.Log(ray);
            
            fire();
        }
    }
    void fire()
    {        
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         Vector3 point = ray.direction;
//            if (Physics.Raycast(ray))
        //{
        GameObject fire = Instantiate(bulletmainCamera.transform.positiontransform.rotationas GameObject;
        fire.rigidbody.AddForce(point*500);
        
        allCount ++;
        updateUI();
        //}    
    }


===================================

===================================
int[,] matrix = new int[,]
{
 {00,00,00},
 {00,00,00}
};

===================================

==特效外掛==
Svn: https://richard6534.no-ip.org/svn/Program/Unity3D/Plugin

*水波紋外掛 unitycoder_com_mWaves2D1.unitypackage
*RPG特效 Dynamic_Elements_FX_Pack_1.2.unitypackage

==NGUI==
中文教學&載點
http://blog.csdn.net/pleasecallmewhy/article/details/8554413

==AR==
http://www.eoeandroid.com/thread-249118-1-1.html

===FaceBook===
https://developers.facebook.com/docs/unity/getting-started/canvas/
http://www.youtube.com/watch?v=YDRh3OkM1Hc

example : https://github.com/fbsamples/friendsmash-unity/



https://www.youtube.com/watch?v=JFKQmylG2mk

沒有留言:

張貼留言