회원 로그인
|
![](http://dvframes.com/rb/_var/simbol/artsone.jpg)
C# 스크립트 기본
C# 스크립트 기본
주의할점
C#의 파일명과 파일 안의 클래스명이 항상 같아야 한다.
1. 유니티 실행
![](http://dvframes.com/rb/files/2013/08/11/8ddc3b5b0521a862f19c53d0d7b30154210411.png)
2. Assets > Create > C# Script 스크립트 하나 생성, 이름을 sample
![](http://dvframes.com/rb/files/2013/08/11/946ca4d41439aeeef3f0928c09e04569210754.png)
3. GameObject > Create Empty 게임 오브젝트(빈 오브젝트) 생성, 이름을 sample
![](http://dvframes.com/rb/files/2013/08/11/8d67fbf76f0a9b78e765ee0049d3814f211529.png)
4. sample 스크립트를 게임 오브젝트에 Drag & Drop
![](http://dvframes.com/rb/files/2013/08/11/d3d4629157f00549e564a42c0574c4db212207.png)
5. sample 스크립트를 더블클릭 해서 편집기 실행
sample이라는 Class와 기본 함수인 Start()와 Update()가 셋팅 (Start()함수 보다 더 먼저 실행되는 Awake()함수도 있다.)
Start() 함수는 실행이 될 때 제일 먼저 실행 되는 함수
Update() 함수는 실시간으로 매 프레임마다(초당 30프레임) 실행되는 함수
주의할점
1. 유니티 실행
![](http://dvframes.com/rb/files/2013/08/11/8ddc3b5b0521a862f19c53d0d7b30154210411.png)
2. Assets > Create > C# Script 스크립트 하나 생성, 이름을 sample
![](http://dvframes.com/rb/files/2013/08/11/946ca4d41439aeeef3f0928c09e04569210754.png)
3. GameObject > Create Empty 게임 오브젝트(빈 오브젝트) 생성, 이름을 sample
![](http://dvframes.com/rb/files/2013/08/11/8d67fbf76f0a9b78e765ee0049d3814f211529.png)
4. sample 스크립트를 게임 오브젝트에 Drag & Drop
![](http://dvframes.com/rb/files/2013/08/11/d3d4629157f00549e564a42c0574c4db212207.png)
5. sample 스크립트를 더블클릭 해서 편집기 실행
using UnityEngine; using System.Collections; # C# 스크립트명 sample.cs와 sample 클래스명이 같아야 한다. public class sample : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
![](/rb/modules/bbs/theme/_pc/list01/image/ico_comment.gif)
146개(1/8페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
![]() |
유니티 강좌 모음(영문) | 푸딩뱃살 | 61749 | 2013.08.28 12:02 |
![]() |
유니티 경고, 에러 모음 (재정리 예정)
![]() |
푸딩뱃살 | 73187 | 2013.08.12 00:09 |
144 |
[콘솔] 오류 : ~ multicast group
![]() |
푸딩뱃살 | 1130 | 2019.09.04 00:23 |
143 |
[콘솔] 오류 : NullReferenceException
![]() |
푸딩뱃살 | 1142 | 2019.07.23 00:26 |
142 | [유니티] Unite Seoul 2019 다시보기 | 푸딩뱃살 | 1285 | 2019.06.28 10:00 |
141 | [정보] GDC 2019 유니티 키노트 하이라이트 | 푸딩뱃살 | 1390 | 2019.03.26 10:45 |
140 |
[유니티] Unite Seoul 2018 아젠다 & 세션 다시보기
![]() ![]() |
푸딩뱃살 | 2775 | 2018.05.25 10:32 |
139 |
[VR/AR] Stereo 360 Image and Video Capture
![]() ![]() |
푸딩뱃살 | 2067 | 2018.02.02 10:53 |
138 | [VR/AR] ARKit - Face Tracking | 푸딩뱃살 | 1811 | 2018.01.17 16:57 |
137 | [참고] ADAM :Making 참고 | 푸딩뱃살 | 2059 | 2017.12.04 11:14 |
136 |
[정보] ARKit Face Tracking on iPhone X
![]() |
푸딩뱃살 | 3170 | 2017.11.08 09:59 |
135 | [VR/AR] Vive Full Body Tracking Demo | 푸딩뱃살 | 2172 | 2017.10.31 18:54 |
134 |
[애셋] 유니티 모델링 - UModeler
![]() ![]() |
푸딩뱃살 | 2214 | 2017.10.20 14:02 |
133 |
[유니티] 맥에서 안드로이드/자바 SDK 경로
![]() ![]() |
푸딩뱃살 | 3358 | 2017.10.04 23:58 |
132 |
[콘솔] 오류 : Fatal Error! The project is on case sensitive file
![]() ![]() |
푸딩뱃살 | 2817 | 2017.10.01 19:59 |
131 | [참고] Adam (Made with Unity) | 푸딩뱃살 | 2537 | 2017.10.01 18:33 |
130 | [정보] 보안 패치 | 푸딩뱃살 | 1946 | 2017.08.21 15:59 |
129 |
[콘솔] 오류: Failed to load '.dll', ......
![]() |
푸딩뱃살 | 2129 | 2017.08.20 00:57 |
128 |
[콘솔] 오류: [VRDevice] Initialization of device oculus failed.
![]() |
푸딩뱃살 | 1970 | 2017.08.19 03:05 |
127 |
[콘솔] 오류: MissingComponentException
![]() |
푸딩뱃살 | 3002 | 2017.08.19 02:05 |
126 |
[콘솔] 오류: Android Manifests
![]() |
푸딩뱃살 | 2772 | 2017.08.18 03:01 |
125 | [VR/AR] Google VR SDK for Unity | 푸딩뱃살 | 3589 | 2017.08.18 00:10 |