90

[C#] 유니티 마우스 후킹, 마우스 제어하기

유니티에서 마우스 후킹, 마우스 제어하기 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Runtime.InteropServices; public class Hook : MonoBehaviour { [DllImport("user32.dll")] static extern void mouse_event(uint dwFlags, uint dx, uint dy, int dwData, int dwExtraInfo); private const uint MOUSEEVENTF_LEFTDOWN = 0x0002; private const uint MOUSEEVENTF_LEFTUP = 0x0004; priva..

툴/유니티 2021.08.02

[C#]유니티 TXT로 저장 및 읽기

유니티 TXT로 저장 및 읽기 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; public class TXT_Info : MonoBehaviour { string A; //TXT의 정보를 담을 변수 void TXT_Save() { System.IO.File.WriteAllText("C:/Example/memo.txt", "txt파일에 적힐 내용"); } void TXT_Load() { A = System.IO.File.ReadAllText("C:/Example/memo.txt"); // 텍스트 파일 내용 불러오기 } } 많고 복잡한 데이터 처리를 하기에는 좋은 방법은 아니지만, 미디..

툴/유니티 2021.08.02

[C#] 유니티 렌더텍스쳐 이미지로 저장

유니티에서 렌더텍스쳐 이미지로 저장 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; public class Shutter : MonoBehaviour { public RenderTexture DrawTexture; //PNG저장할 타겟 렌더 텍스쳐 void RenderTextureSave() { RenderTexture.active = DrawTexture; var texture2D = new Texture2D(DrawTexture.width, DrawTexture.height); texture2D.ReadPixels(new Rect(0, 0, DrawTexture.width, Dr..

툴/유니티 2021.08.02

[C#] 유니티에서 FTP로 파일 전송 및 파일 다운로드

유니티에서 FTP로 파일 전송 및 파일 다운로드 using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using System.Net; public class FTPTesttt : MonoBehaviour { void Start() { //업로드 코드 WebClient wc = new WebClient(); wc.Credentials = new NetworkCredential("아이디", "비밀번호"); wc.UploadFile("ftp://example.com/img.png", "D:/example/img.png"); // 괄호안 첫번째는 업로드시킬 웹 주소, 두번째는 업로드할 파일의 로컬 주..

툴/유니티 2021.08.02

유니티에서 타프로그램 창 화면 가져오기

https://github.com/hecomi/uWindowCapture GitHub - hecomi/uWindowCapture: This allows you to use Windows Graphics Capture / PrintWindow / BitBlt in Windows to capture mul This allows you to use Windows Graphics Capture / PrintWindow / BitBlt in Windows to capture multiple windows individually and easily use them as Texture2D in Unity. - GitHub - hecomi/uWindowCaptur... github.com 윈도우에서 작업표시줄에 표시되..

툴/유니티 2021.08.02

[C#]유니티 JSON 데이터 받아오기

유니티에서 Json 데이터 받기 using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class JsonData { public int A; public string B; } public class JsonReceiver : MonoBehaviour { public static JsonData data1; WWW www; string T; public string url = "Json데이터 받아올 URL주소"; void Start() { InvokeRepeating("CoroutineLoad", 0, 1f); //Json데이터 반복해서 업데이트 } void Updat..

툴/유니티 2021.08.02

AR Foundation 트랙킹 실패시 오브젝트 끄기

https://youtu.be/qIxClnigves AR 개발을 하면서 이 튜토리얼을 보고 많이 도움이 됐다. 감사합니다. 그런데 몇번씩 똑같이 만들었지만, 뭐가 문제인지 이미지 트랙킹안되는 상황이 되도 오브젝트가 안꺼짐. 댓글에도 똑같이 안되는 사람들이 있었음. 아마 버전차이거나 환경셋팅이 좀 달라진게 있었던게 아닌가 싶음. ​ 일일히 디버그 찍어보면서 어디서 코드가 작동안하나 확인해봤고, 결국 내 환경에서 작동이 되게 수정함 코드 백업 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR; using UnityEngine.XR.ARFoundation; ​ public class..

툴/유니티 2021.08.01

후디니 VAT 인터페이스

후디니로 유체 움직임 시뮬레이션을 VAT로 만들어서 유니티에서 가져와 실행시키려고 튜토리얼을 찾아봤으나 그분들의 후디니와 내 후디니의 상태가 좀 달랐다.(현재 후디니 18.5.633) 유튜브 튜토리얼의 화면인데 파라미터?창이 이렇게 상단에 UserInterface도 있고 이래야 하는데 내 화면은 이랬다. UserInterface도 없고 VAT3.0뭐시기 얘기 하고 있고 결국 VAT로 Export하면 에러나거나 출력물 형태가 좀 이상해서 유니티에서 쓸수가 없었다. ​ 그래서 후디니 오픈톡방에 집단지성을 빌려 질문했고 바로 답을 받았다. VAT2.0?3.0? 최근에 버전이 넘어가면서 많이 바뀌었다했고 Export할때 언리얼이든 유니티든 적용하는 값도 바뀐거 같다. 암튼 최근 버전이라 생긴 문제고 그래서 그런..

툴/후디니 2021.08.01

후디니와 게임엔진

​ 버텍스의 움직임 값을 텍스쳐로 가져와서 VAT(Vertex Animation Texture)포맷으로 표현하기 어려운 유체의 형태나, 정교한 천의 움직임 시뮬레이션을 후디니에서 VAT포맷을 활용해서 만들수 있었다. ​ VAT로 물체가 부숴지는 형태도 만들기는 한데, FBX로도 가져올수 있어서 이 둘의 장단점은 아직 잘 모르겠다. 또한 후디니의 절차적 모델링을 게임엔진으로 가져오는 HDA 형태도 재밌는거 같다. ​ 그래서 더 다양한 표현을 하고자 콜로소에서 후디니 강좌를 구매하고 라이센스까지 구매했다. 후디니는 보조 역할일거 같지만 공부해봐야지

툴/후디니 2021.08.01