GameObejct.SendMessage :

  • 대상 오브젝트에 속해 있는 모든 컴포넌트에 해당하는 함수명을 호출, 호출할 객체가 없을 시 에러처리 방식 지정가능.
  • 메타 데이터를 읽는 리플렉션 기능이 들어가 있음
  • 메타 데이터를 전부 읽어 해당하는 함수명을 찾기에 오래걸림
  • 함수명 전달 시, 오타로 인한 문제 있을 수 있음
  • 접근제한자 기능을 무시하고 호출

Component.BroadcastMessage

  • 씬 전체의 모든 오브젝트에 SendMessage 적용
참고 링크:
 

Unity - Scripting API: Component.BroadcastMessage

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

 

Unity - Scripting API: GameObject.SendMessage

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

 

[유니티 C# 기초 강의] 13. SendMessage와 BroadcastMessage

이 글은 PC 버전 TISTORY에 최적화 되어있습니다. 서론이번에는 SendMessage와 BroadcastMessage를 이용해서 오브젝트의 붙은 컴포넌트의 함수를 이름으로 호출하는 방법에 대해서 배워보도록 하겠습니다.

itmining.tistory.com

 

SendMessage 예제

유니티에서 스크립트에 있는 메소드를 호출하는 방법에는 크게 두 가지가 있습니다. 일반적인 방법인 해당 ...

blog.naver.com

 

'프레임워크 > Unity' 카테고리의 다른 글

[Unity] Symbolic Link 를 이용한 Switching Platform  (0) 2023.08.17

+ Recent posts

let textNodes = document.querySelectorAll("div.tt_article_useless_p_margin.contents_style > *:not(figure):not(pre)"); textNodes.forEach(function(a) { a.innerHTML = a.innerHTML.replace(/`(.*?)`/g, '$1'); });