1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | // 해상도 고정 Screen.SetResolution(2560, 1440, true); // 스크립트내에서 텍스트 내용 편집 public Text ResultScore; var PL = GameObject.Find("Player").GetComponent<Player>(); string Score = PL.score.ToString(); ResultScore.text = Score; // 오브젝트 클릭시 using UnityEngine.EventSystems; public class RightArrow : MonoBehaviour,IPointerDownHandler,IPointerUpHandler { public void OnPointerDown(PointerEventData data) { } public void OnPointerUp(PointerEventData data) { } } // UI의 위치 변경. 또는 RectTransform 변경 RectTransform RT = (RectTransform)gameObject.transform; RT.anchoredPosition = new Vector2(0, 0); // 트리거 충돌 private void OnTriggerEnter(Collider other) { if (other.tag == "DestroyWall") } // 타 오브젝트 스크립트 저장하기 var GR = GameObject.Find("GameRoot").GetComponent<GameRoot>(); // 타 오브젝트 저장하기 private GameObject Player = null; Player = GameObject.FindGameObjectWithTag("Player"); // 타 오브젝트 제거시 DestroyObject(jump); // 본인 오브젝트 제거시 Destroy(this.gameObject); // 부모 오브젝트를 자신으로 설정 Result.transform.parent = this.transform; // 프리팹 생성 Instantiate(Block); // 애니메이터 컴포넌트 private const string anime = "animation"; this.animator = GetComponent<Animator>(); this.animator.SetInteger(anime, 9); // 컬라이더 충돌 private void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "Block") } // 씬이 넘어가도 오브젝트는 유지되도록 DontDestroyOnLoad(gameObject); // 하이드 기능 gameObject.SetActive(false); false 시 하이드 true시 언하이드 | cs |
'휴지통' 카테고리의 다른 글
Python 전역변수를 사용하는 여러가지 방법 (0) | 2022.12.20 |
---|---|
The associated script can not be loaded (0) | 2022.12.20 |
Unity 오브젝트 이동 및 회전 하기 (0) | 2022.12.20 |
Unity "Can't add script" Error (0) | 2022.12.20 |
NullReferenceException (0) | 2022.12.20 |