본문 바로가기
반응형

개발/Unity24

유니티 C# 기본 문법 정리 - 변수, 조건문, 반복문, 배열, 함수, 클래스 등등 1. 변수 (Variables) 변수를 선언할 때는 데이터 형식을 지정하고 이름을 부여합니다. int score = 100; string playerName = "John"; float speed = 5.0f; // f 접미사는 부동 소수점 수를 나타냅니다. 2. 조건문 (Conditional Statements) 게임에서 조건에 따라 특정 동작을 수행할 때 사용됩니다. if (score > 90) { Debug.Log("Excellent!"); } else { Debug.Log("Try again."); } 3. 반복문 (Loops) 게임 루프 내에서 일련의 작업을 반복적으로 수행할 때 사용됩니다. for (int i = 0; i < 5; i++) { Debug.Log("Iteration: " + i).. 2023. 10. 18.
java.io.IOException: Can't read [C:\Users\shahp\.gradle\caches\transforms-2\files- 에러 대응법 오류 내용 java.io.IOException: Can't read [C:\Users\shahp\.gradle\caches\transforms-2\files-2.1\328b84521e30516b8226e4c8a181416f\jetified-googlemobileads-unity-runtime.jar(;;;;;;;**.class)] (Can't process class [com/google/unity/ads/AdNetworkExtras.class] (Unsupported version number [55.0] (maximum 54.0, Java 10)))​ 해결 방법 현재 사용중인 Google Moblie Ads 패키지 재설치 2023. 8. 24.
Unity iOS Xcode 빌드시 Info.plist 자동 수정 간단 구현 코드 작성 using System.IO; using UnityEditor; using UnityEditor.iOS.Xcode; public class IOSBuildOption { [UnityEditor.Callbacks.PostProcessBuild] public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject) { if (buildTarget == BuildTarget.iOS) { // Get plist string plistPath = pathToBuiltProject + "/Info.plist"; PlistDocument plist = new PlistDocument(); plist.ReadFromStr.. 2023. 8. 19.
유니티 C# 스크롤바 Scrollbar 사용법 간단 구현 코드 작성 using UnityEngine; using UnityEngine.UI; public class ScrollbarController : MonoBehaviour { public Scrollbar scrollbar; public RectTransform contentTransform; void Start() { scrollbar.onValueChanged.AddListener(OnScrollbarValueChanged); } void OnScrollbarValueChanged(float value) { float contentHeight = contentTransform.rect.height; float viewportHeight = scrollbar.GetComponent().rect.heig.. 2023. 5. 11.
유니티 C# 네임스페이스 간단 사용법 Unity namespace 네임스페이스란? 유니티에서 코드를 구조화하고 이름 충돌을 방지하는 데 사용됩니다. 코드 작성 namespace MyNamespace { using UnityEngine; public class MyScript : MonoBehaviour { // Your script code goes here } } 2023. 4. 30.
유니티 쉐이더 Shader 간단 사용법 코드 작성 Shader "Custom/ExampleShader" { Properties { _MainTex ("Texture", 2D) = "white" {} _Color ("Color", Color) = (1,1,1,1) _Speed ("Speed", Range(0, 10)) = 1 } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOOR.. 2023. 3. 31.
유니티 에디터 단축키 간단 사용법 Unity Editor 일반 Ctrl + N: 새 씬을 만듭니다. Ctrl + O : 기존 씬을 엽니다. Ctrl + Shift + S: 현재 씬을 저장합니다. Ctrl + S: 열려 있는 모든 씬을 저장합니다. Ctrl + Shift + P: 재생 모드 창을 엽니다. Ctrl + P: 게임 보기를 전체 화면 모드와 창 모드로 전환합니다. Ctrl + Shift + B: 프로젝트를 빌드합니다. Ctrl + Shift + A: 선택한 게임 개체에 새 구성 요소를 추가합니다. Ctrl + Shift + Z: 마지막 작업을 취소합니다. Ctrl + Y: 마지막 작업을 다시 실행합니다. 씬 W : 이동 도구를 선택합니다. E : 회전 도구를 선택합니다. R : 크기 조정 도구를 선택합니다. Q : 사각형 도구를 선택합니다. F : 선.. 2023. 2. 17.
유니티 생명 주기 Life Cycle 간단 설명 using UnityEngine; public class UnityLiftCycle : MonoBehaviour { void Awake() { Debug.Log("1"); } void OnEnable() { Debug.Log("2"); } void Start() { Debug.Log("3"); } void FixedUpdate() { Debug.Log("4"); } void OnTriggerEnter(Collider other) { Debug.Log("5"); } void OnCollisionEnter(Collision other) { Debug.Log("6"); } void Update() { Debug.Log("7"); } void LateUpdate() { Debug.Log("8"); } void .. 2022. 8. 17.
유니티 허브 설치 및 개발 환경 세팅하기 Unity Hub 유니티 허브 설치 https://unity3d.com/kr/get-unity/download Download Unity! Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers. unity3d.com 유니티 원하는 버전 설치 (LTS 추천) https://unity3d.com/kr/get-unity/download/archive Get Unity - Download.. 2022. 7. 12.
유니티 모바일 64비트 빌드 최적화 세팅 모음 Unity Moblie Build 물리를 사용하지 않는다면 Project Settings / Qualitiy / Auto Simulation, Auto Sync Transforms 끄기 프레임 조절 보드 게임 Application.targetFrameRate = 30 Fps 게임 Application.targetFrameRate = 60 빌드 압축 형식 Build Settings / Texture Compression ETC Compression Method LZ4HC 선택 64비트 빌드를 위한 플레이어 설정 Project Settings / Player / Other Settings Color Space = Linear 선택 Multithreaded Rendering 사용 Static Batching 사용 Compute Skinning.. 2022. 7. 9.
유니티 파티클 시스템 Particle System 간단 정리 Prewarm 처음부터 재생 Bursts 동시에 입자를 확 뿜어낼 수 있음 (담배 도넛 효과) Shape 입자가 나올 모양의 형태를 지정할 수 있음 Velocity Over LifeTime 원하는 방향으로 속도를 부여할 수 있음 (태풍 효과) Limit Velocity over LiftTime 저항을 줄 때 편함 Force over LifeTime 일정한 방향으로 힘을 계속 가함 Color over LifeTime 시간이 지날수록 색깔을 변화 시킴 (중간에도 색을 지정할 수 있음) Color by Speed 입자에 스피드에 따른 색깔 지정 Size over LifeTime 시간이 지날수록 크기를 변화 시킴 Noise 파티클의 움직임을 방해함 (부들부들 떨리는 효과) Collision 입자에 충돌 가능 여.. 2022. 6. 16.
유니티 유용한 에셋 추천 모음 Unity Asset DOTween Pro UI 애니메이션, 페이드 인 아웃 등 간편한 효과들을 쉽게 적용시킬 수 있는 Asset DOTween Pro | 비주얼 스크립팅 | Unity Asset Store Get the DOTween Pro package from Demigiant and speed up your game development process. Find this & other 비주얼 스크립팅 options on the Unity Asset Store. assetstore.unity.com Odin - Inspector and Serializer 편집기나 인스펙터창에서 여러가지 편리한 기능을 사용할 수 있는 Asset Odin - Inspector and Serializer | 유틸리티 도구 | Unity As.. 2022. 6. 15.
반응형