Network disconnection
Description
코드의 8번째 줄을 보면 TestMethod가 정의되어 있는데요. TestMethod는 매개변수로 String 타입의 값을 받고 있습니다.
하지만 코드 5번째 줄에서는 TestMethod를 호출하면서 아무 값도 넘겨주지 않고 있습니다. 이대로 실행하면 에러가 발생하는데요. 코드의 5번째 줄에 있는 빈칸을 알맞게 채워 코드가 정상적으로 실행되도록 해 보세요.
Fill type challenge HOWTO
- In the Fill type challenge, you have to fill the blank with appropriate code
- The given code except the blank cannot be edited.
- An error message will be shown in the Result area when you leave the blank empty.
1
2
3
4
5
6
7
8
9
using System;
public class UserCode : MonoBehaviour{
void Start(){
TestMethod( );
}
void TestMethod(String str){
Console.WriteLine("매개변수로 받은 값은 '" + str + "'입니다.");
}
}
1
2
3
4
5
6
7
// 아래는 시스템 동작을 위한 코드입니다.수정하지 마세요
public class MainRunner{
public static void Main(){
MonoBehaviour mono = new MonoBehaviour();
mono.RunMono();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Unity의 MonoBehaviour와 유사하게 동작하기 위한 코드입니다.
// 수정하지 마세요
using System.Reflection;
public class MonoBehaviour{
public void RunMono(){
UserCode userCode = new UserCode();
MethodInfo mStartInfo = typeof(UserCode).GetMethod("Start", BindingFlags.NonPublic | BindingFlags.Instance);
if(mStartInfo != null){
mStartInfo.Invoke(userCode, null);
}
MethodInfo mUpdateInfo = typeof(UserCode).GetMethod("Update", BindingFlags.NonPublic | BindingFlags.Instance);
if(mUpdateInfo != null){
for(int i = 0; i < 10; i++){
mUpdateInfo.Invoke(userCode, null);
}
}
}
}
Result
Stop
Result of [Run] or [Submit] will be displayed here