public void addbotton(float back_x, float back_y, GameObject thisbutton)
    {
        GameObject go = NGUITools.AddChild(gameObject, thisbutton);
        Transform t = go.transform;
        t.localPosition = new Vector3(back_x, back_y, 0);

gundamhina 發表在 痞客邦 留言(0) 人氣()

using UnityEngine;
using System.Collections.Generic;
using System;

gundamhina 發表在 痞客邦 留言(0) 人氣()

publlic class MyClass{
//宣告自定義的字串變數(屬性)
private String Text1="";
//宣告自定義的整數變數(屬性)
privateint number=1;

gundamhina 發表在 痞客邦 留言(0) 人氣()

using UnityEngine.SceneManagement;

 void OnClick()
    {
SceneManager.LoadScene("SceneName", LoadSceneMode.Single);

gundamhina 發表在 痞客邦 留言(0) 人氣()

float X = Random.Range(-13.0F, 13.0F);

gundamhina 發表在 痞客邦 留言(0) 人氣()

private Transform Camera;

Camera = GameObject.FindGameObjectWithTag("MainCamera").transform; //抓鏡頭參數

gundamhina 發表在 痞客邦 留言(0) 人氣()

GetComponentMove();//獲取物件的Move組件

public class ScriptA : MonoBehaviour {
GameObject target;
void Start(){
target = GameObject.Find("ObjectB");

gundamhina 發表在 痞客邦 留言(0) 人氣()

OnCollision 碰撞事件

    發生條件:
  • 當兩個非觸發區(Is Trigger未勾選)的物件碰撞,且一方帶有Rigidbody(剛體),就會發生Collision事件。

  • 事件類型:
    OnCollisionEnter2D 碰撞事件

gundamhina 發表在 痞客邦 留言(0) 人氣()

Instantiate(參數1,參數2,參數1,)

Instantiate – 複製物件

  1. 參數1 – 被複製的遊戲物件

  2. 參數2 – 複製出來的物件的位置

  3. 參數3 – 複製出來的物件的旋轉(四元數)

gundamhina 發表在 痞客邦 留言(0) 人氣()

  • OnMouseDown – 滑鼠點擊事件:在滑鼠點擊物件時會觸發

  • OnMouseDrag – 滑鼠拖曳事件:在滑鼠點擊後「按住」滑鼠時會觸發

  • OnMouseUp – 滑鼠放開事件:在滑鼠點擊後,放開滑鼠時會觸發

  • OnMouseEnter – 滑鼠進入事件:在滑鼠進入物件的碰撞區時觸發

  • OnMouseExit – 滑鼠離開事件:在滑鼠離開物件的碰撞區時觸發

gundamhina 發表在 痞客邦 留言(0) 人氣()

-GameObject 遊戲物件

-Vector2 ,Vector3  二維向量,三維向量

Vector2 vec2 = new Vector2(1,0);  //x=1 , y=0

Vector.up 代表(0,1)

Vector2Vector3的參數都是float,在輸入小數的時候必須加上「f

gundamhina 發表在 痞客邦 留言(0) 人氣()

1
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。