전체 글16 유니티 토글 그룹에서 선택된 토글 가져오기 using System.Linq; void Example() { Toggle theActiveToggle = toggleGroup.ActiveToggles().FirstOrDefault(); } 2021. 1. 28. 유니티 2D Sprite 크기를 화면 크기로 SpriteRenderer spriteRenderer = gameObject.GetComponent(); if (spriteRenderer == null) return; gameObject.transform.localScale = new Vector3(1, 1, 1); float _width = spriteRenderer.bounds.size.x; float _height = spriteRenderer.bounds.size.y; float worldScreenHeight = (float)(Camera.main.orthographicSize * 2.0); float worldScreenWidth = worldScreenHeight / Screen.height * Screen.width; gameObject.. 2021. 1. 27. XML 개행문자 C#에서 XML 가져올 때 XML 내부 내용 개행 첫 번째 줄입니다. 두 번째 줄입니다. => 첫 번째 줄입니다. 두 번째 줄입니다. 2021. 1. 15. C# XML 읽어오기 string _path = @"C:/Test.xml"; XmlDocument Document = new XmlDocument(); Document.Load(_path); XmlNodeList xmlNodeList = Document.SelectNodes("TestList"); 2020. 12. 1. C# DateTime 포맷 // create date time 2008-03-09 16:05:07.123 DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123); String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24 String.Format("{0:m mm}", dt); // "5 05" .. 2020. 9. 2. 유니티 Microphone 녹음 시작-종료 지점 잘라서 녹음. AudioClip recordClip; void StartRecordMicrophone() { recordClip = Microphone.Start("Built-in Microphone", true, 100, 44100); } void StopRecordMicrophone() { int lastTime = Microphone.GetPosition(null); if (lastTime == 0) return; else { Microphone.End(Microphone.devices[0]); float[] samples = new float[recordClip.samples]; recordClip.GetData(samples, 0); float[] cutSamples = new float[lastTime]; .. 2020. 8. 28. 이전 1 2 3 다음