» unity の記事

~ fix unity 3dText Always on top problem ~

connie 2017.04.19 | unity | | No Comments

Fixing the 3d text always on top layer problem,

左邊係我地常出現的情況,右手邊係我地想要既情況

以下方法不能使用預設FONT,要import 字型入去,我用勘亭流做例子

將字型IMPORT入去ASSET內,在inspector的character 轉成unicode,再Create editable copy

甘生了一個字型texture出來

之後在ASSET Folder Create 新既shader

Shader "GUI/3D Text Shader" {
	Properties{
		_MainTex("Font Texture", 2D) = "white" {}
	_Color("Text Color", Color) = (1,1,1,1)
	}

		SubShader{
		Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
		Lighting Off Cull Off ZWrite Off Fog{ Mode Off }
		Blend SrcAlpha OneMinusSrcAlpha
		Pass{
		Color[_Color]
		SetTexture[_MainTex]{
		combine primary, texture * primary
	}
	}
	}
}

之後在ASSET Folder Create 新既Material

New Material 內Shader部份用GUI->3D Text shader 即係剛剛加入的Shader

然後Texture 加入剛剛做出來的Font Texture

然後去3D Text Object , Mesg Renderer內materials 由Font Texture 改為new material,甘就可以了

~ Fix the problem of unity textmesh blurry ~

connie 2017.04.12 | unity | | No Comments

1491965784579

Set the character Size to 0.03 and increase the Font size

1491965592307
1491965603898

~ 2D mouse click on unity ~

connie 2017.03.03 | unity | | No Comments

在要hit test的gameobject內加入Box Collider 2D

01

 // Update is called once per frame
    void Update() {
        if (Input.GetMouseButtonDown(0))
        {
            print("mousedown");

            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

            if (hit.collider != null)
            {
                print(hit.collider.gameObject.name);
            }
        }
    }

 

~ Create androidManifest.xml in unity5 ~

connie 2017.02.20 | unity | | No Comments

compile a apk , and go to

C:\{unityProject}/Temp/StagingArea/AndroidManifest.xml
copy to unity->Assets/Plugins/Android

upgrade from jdk 1.7 to 1.8

edit->preference->external Tools->JDK->1.8

 

| HOME | Next Page »

Smiley face

April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930