블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2731)
Unity3D (814)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (57)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (51)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
03-28 00:02

'ExecuteInEditMode'에 해당되는 글 1건

  1. 2015.07.16 작성된 스크립트를 EditMode에서 바로 적용되도록[ExecuteInEditMode]

유니티로 개발을 하다보면 스크립트에서 public으로 빼놓은 것을 

EditMode(작업모드)에서 바로 적용된 것을 보고 싶을때가 있습니다.

처음에 유니티를 하게되면 항상 ▶버튼을 눌러 실행을 한 후 확인하게 됩니다.


물론 ▶버튼을 눌러서 확인을 해야 하는 경우도 있지만 가볍게 변경된 것을 스크립트를 통해 바로 확인하고 싶을 때 사용하면 좋을 것 입니다.


[ExecuteInEditMode] 를 사용하여 바로 변경되도록 할 수 있는데요.

이 키워드를 스크립트에서 class위에 배치를 하면 Update부분에 적용한 것을 EditMode에서 바로 확인 하실 수 있습니다.


/* 예제 */

/*******************************************************************/

[ExecuteInEditMode]

public class UIRoot : MonoBehaviour

{

void Update()

{

//EditMode이든 실행되는 화면이든 변경되었으면 하는 부분 처리

}

}

/*******************************************************************/ 






위에 두 그림 처럼 Manual Height 의 값을 조정하면 Transform 부분에 Scale 부분에 값이 변하는 것을 확인 하실 수 있을껍니다.

위에 두 그림은 실행모드가 아닌 EditMode임을 말씀 드립니다.




출처 : http://jhc777.tistory.com/65




The functions are not called constantly like they are in play mode.
Update is only called when something in the scene changed.
OnGUI is called when the Game View recieves an Event.

OnRenderObject and the other rendering callback functions are called on every repaint of the Scene View or Game View.


참조 : http://docs.unity3d.com/ScriptReference/ExecuteInEditMode.html

반응형
Posted by blueasa
, |