Text2D.cs 를 FloatingTextLabel 라벨이 추가한다.
* TargetObject에 따라다닐 오브젝트를 추가 ( 위에서 만든, 'objTest'를 추가 )
* Worl... a mainCamera;
public Camera guiCamera;
public GameObject prefab;
public void fire( Vector3 clickedPos_ )
{
GameObject _gameObj = Instantiate( prefab, clickedPos_, Quaternion.identity ) as GameObject;
// No mean yet, just align as child
SomeTool
playmaker:pmexam1_hierarchy_2.png|}}
* **MovingObject** : 이동할 오브젝트
* **Position** : 오브젝트가 이동할 경로들의 부모... 동할지, 랜덤하게 선택하게 이동할지 결정.
* **MsgRecver** : MovingObject의 메시지를 받을 서브 오브젝트.
===== 씬 화면 =====
| {{:languag... ker:pmexam1_gameview_1.png|}} | 움직일 오브젝트, **MovingObject** |
| {{:language:unity:4-playmaker:pmexam1_gamev... 모름
===== PlayMaker FSM 추가 =====
게임 오브젝트 **MovingObject**에 새로운 FSM 추가.
(PlayMaker 태그가 붙어 있는 스샷 추가)
====
ing System.Collections.Generic;
public class GameObjectPool
{
protected Queue<GameObject> mDefautQueue;
protected int mRefillTiming = 5;
protected int mCnt...
protected int mMaxNumber = 20;
protected GameObject mTargetPrefab;
protected GameObject mParentObj;
public void initQueue( GameObject parentObj_, GameOb
====== 객체를 멈춘 상태로 만들어 놓고, 시작할때 활성화 할때 ======
GameObject를 비활성활 상태로 만들고 필요할때 활성화할때.
* Awake()에서 <code>gameObject.SetActive(false);</code>로 비활성 상태로 만들고,
* 필요할때, <code>gameObject.SetActive(true)</code> 호출해서 활성화한다.
그리고,
* **Sta... tation/ScriptReference/index.Accessing_Other_Game_Objects.html|Overview: Accessing Other Game Objects]]
=
enpick-1.jpg|}}
====== 사용할 변수 ======
* didPickObject : 게임오브젝트가 선택 되었는가?
* pickedGameObject : 선택한 게임 오브젝트 저장
* mouseX, mouseY : 마우스가 클릭된 화면상의 위치
* isDebu... ty:playmaker:pm-screenpick-3.jpg|}}
====== 'checkObject' state ======
- Screen Pick : 전제 조건이 있어서 헤매는 부... *가 설정되지 않으면, 오브젝트를 얻어오지 않았다.</color>
* didPickObject와 pickedGameObject 에 확인된 오브젝트를 저장한다.
- Game Obje
tation/ScriptReference/index.Accessing_Other_Game_Objects.html|Overview: Accessing Other Game Objects]]
===== 다른 게임 오브젝트의 컴포넌트나 스크립트 사용 =====
<code csharp>
publ... xample : MonoBehaviour {
void Start() {
GameObject go = GameObject.Find("SomeGuy");
go.GetComponent<OtherScript>().DoSomething();
GameObject player
com/Documentation/ScriptReference/EditorGUILayout.ObjectField.html|EditorGUILayout.ObjectField]]
====== Button 과 같은 이벤트 리시버를 인스펙터에 추가 ======
UnityEvent 로 public... e csharp>
// Create a new prefab for the atlas
Object prefab = (go != null) ? go : PrefabUtility.CreateEmptyPrefab(prefabPath);
// Create a new game object for the atlas
string atlasName = prefabPath.Repl
===== 간단한 프레임 구성 =====
<code>
DebugWindow : GameObject
DW_Bkgnd : UISlicedSprite 로 배경 이미지를 윈도우 크기만큼 늘... * DW_Title 에
* Box Collider를 추가
* UIDragObject 스크립트를 추가한다.
* UIDragObject 에 드래그 이동을 할 오브젝트를 Target 항목에 설정한다.
* 인스펙터에서 DebugWindow Object를 **UIDragObject**의 **Target** 항목에 추가한다.
실행 결과는,
a; // 기준이 되는 카메라는, 외부에서 변수 등록할 수 있게 설정
public GameObject targetObject; // 마우스 클릭에 반응할 오브젝트
void Update() {
RaycastHit _hitRet = new RaycastHit(); // 결과를 저장할 Rayca... Position ); // subCamera시점에서 마우스 위치를 ...
// targetObject가 마우스 클릭 지점에 있는지, 클릭한 지점의 위치는 어디인지 얻는다.
if( targetObject.collider.Raycast( _cameraRay, out _hitRet, 40f )
oBehaviour {
void Start () {
iTween.MoveTo( gameObject,
iTween.Hash(
"time", 5,
"path", iTweenP... 로 만큼 이동하게 한다.
void Start() {
iTween.MoveTo( gameObject,
iTween.Hash(
"path",iTweenPath.GetPath... 가해서, 움직임이 끝나면 새로운 움직임을 새로 추가
iTween.RotateTo( gameObject,
iTween.Hash(
"rotation", Random.rotation.... ype)Random.Range( 0, 31 );
iTween.RotateTo( gameObject,
iTween.Hash(
"rotation", Random.rotat
s.unity3d.com/questions/348642/how-to-scale-a-gameobject-to-fit-within-a-rect-.html|How to scale a gameObject to fit within a Rect]]
* [[http://docs.unity3d.com... s/521410/how-to-resize-a-cameras-orthosize-for-an-object-to.html|How to resize a camera's orthoSize for an object to fit inside its rect viewport]]
* [[http://an