회원 로그인
|
함수의 인자 (with Unity)
함수의 인자
인자
함수 내부에 사용되는 변수
함수를 호출하면서 함수에 보내는 정보
*인자 값을 바꿔주어 다시 출력 값 확인
//유니티 스크립트 기초 강좌 C# 30:32/51:21
C#과 다른 부분 없이 Unity 스크립팅 기반으로 작성 됨 |
인자
//간단 예제 SumNumbers(10,20); AddHP(100); AddMP(150);*함수을 호출하면서 값(숫자나 문자)을 넣어주는 것이 인자
//인자 예제 //게임 실행 될때 Calculate() 함수 인자 값을 출력하는 스크립트 using UnityEngine; using System.Collections; public class sample : MonoBehaviour { public int indexNumber = 10; public string myName = "Gomdol"; // Use this for initialization void Start () { //3. Calculate() 함수에 30,50이라는 인자 값을 넣음 int numberIGot = Calculate(30,50); Debug.Log(numberIGot); } //1. Calculate() 함수에 인자 정수형 numA와 numB를 추가 int Calculate(int numA, int numB) { //2. 받아온 인자 변수들을 더함 int sum = numA + numB; return sum; } // Update is called once per frame void Update () { } }4. 게임 실행하여 출력하면 80
*인자 값을 바꿔주어 다시 출력 값 확인
//유니티 스크립트 기초 강좌 C# 30:32/51:21
댓글 0개
| 엮인글 0개
285개(13/15페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
45 | [VisualStudio] Visual Studio 2010 Express 다운로드 | 푸딩뱃살 | 2886 | 2014.01.06 17:44 |
44 | [C#] 비교 연산자 | 푸딩뱃살 | 2891 | 2013.12.29 01:35 |
43 | [C#] 산술 연산자 | 푸딩뱃살 | 3646 | 2013.12.26 00:38 |
42 | [C#] 열거형 | 푸딩뱃살 | 2181 | 2013.12.25 01:29 |
41 | [C#] 다차원 배열 - 재그 배열 | 푸딩뱃살 | 2902 | 2013.12.21 18:36 |
40 | [C#] 다차원 배열 | 푸딩뱃살 | 2662 | 2013.12.21 15:55 |
39 | [C#] 배열(Array) | 푸딩뱃살 | 2254 | 2013.12.19 11:53 |
38 | [C#] 데이터 타입과 변수 | 푸딩뱃살 | 3801 | 2013.12.12 14:04 |
37 | [C#] 기본 구조 | 푸딩뱃살 | 2088 | 2013.12.12 10:11 |
36 | [C#] 키워드 (예약어) | 푸딩뱃살 | 3408 | 2013.12.11 13:59 |
35 | [C#] ILSpy - C# Decompiler [1+1] | 푸딩뱃살 | 5946 | 2013.11.24 14:47 |
34 | [Python] PyQt4 - Toolbar 예제 | 푸딩뱃살 | 3373 | 2013.11.12 10:19 |
33 | [C#] 반복문 - for (with Unity) | 푸딩뱃살 | 4981 | 2013.08.14 01:26 |
32 | [C#] 다중 조건문 &&(and), ||(or) (with Unity) | 푸딩뱃살 | 12593 | 2013.08.14 01:15 |
31 | [C#] 조건문 - if else (with Unity) | 푸딩뱃살 | 4582 | 2013.08.14 01:00 |
>> | [C#] 함수의 인자 (with Unity) | 푸딩뱃살 | 3710 | 2013.08.14 00:47 |
29 | [C#] 커스텀 함수 (with Unity) | 푸딩뱃살 | 3704 | 2013.08.13 22:50 |
28 | [C#] 함수 (with Unity) | 푸딩뱃살 | 3621 | 2013.08.13 01:08 |
27 | [C#] 변수 선언 (with Unity) | 푸딩뱃살 | 2987 | 2013.08.06 23:27 |
26 | [C#] 커맨드 (with Unity) | 푸딩뱃살 | 2499 | 2013.08.06 00:13 |