A System Integrated with C# Programing and Real-Time 3D Observation for Learning Virtual Reality Technology


With the rapid development of virtual reality technology (VR), application systems based on VR have been demonstrated in wide fields, which therefore make it attractive to many university students. The process of learning VR requires intensive programing and intuitive observation as well as strict understanding of basic concepts, significantly different to that of other courses. The current widely used framework of learning system is not suitable to the VR learning. In this paper, we present a learning platform based on Unity 3D for VR learning. This system combines knowledge learning, real-time interaction between virtual scene control and C# writing/compiling. Compared with other learning systems, this system can greatly promote the learning enthusiasm and efficiency for C# programming in 3D VR applications.

Share and Cite:

Li, X. , Liu, D. and Zhang, X. (2019) A System Integrated with C# Programing and Real-Time 3D Observation for Learning Virtual Reality Technology. Open Journal of Social Sciences, 7, 127-135. doi: 10.4236/jss.2019.73009.

1. Introduction

The traditional method in classroom teaching faces many practical problems, such as low teaching efficiency for teachers and low learning enthusiasm for students. With the rapid development of computer and information technology, in order to solve this problem, the computer learning systems have received extensive attention for their convenience, intuitiveness, efficiency and interactive advantages,and have become a promising learning tool in the field of education. Some teams have developed different types of learning systems for courses such as physical chemistry experiments, computer technology, electronic and electrical engineering [1] [2] [3]. Learning systems for learning computer programming has been greatly developed [4] [5].

In recent years, 3D virtual reality technology (VR) has gradually become a hot field. However, the basic problems involved in VR are mostly abstract and difficult to understand, such as virtual scenes, physical effects, animation and human-computer interaction, and there is no real-time 3D observation, this is the reasons why students cannot really understand the concepts of 3D simulation, and become an obstacle to programming learning and stimulating students’ learning motivation. In the existing programming learning system, there is no system to compile the code written by the students in real time to control the objects in the virtual scene, so this method has great development potential in the programming learning system.

In order to realize the above method, this paper designs a VR learning platform for Unity 3D, which as a powerful development tool is widely used in VR field. This platform has a Unity 3D programming interface, which sends C# codes to the console for compiling through Socket communication. If the compilation is successful, the console compiles the code into a DLL file. The system then creates class objects in the DLL file by reflection technology, and dynamically applies these objects to game objects in the 3D scene. The interactive interface can be linked to the corresponding website with learning resources. The advantage of this method is that students can learn programming directly and easily, and obtain learning resources on the Internet, which greatly changes the shortcomings of traditional teaching methods.

2. Related Work

The learning systems for computer programming employed different learning modes, for example, an C++ object-oriented programming laboratory course with framework-assisted is a highly effective way for students to broadening and deepening their object-oriented programming skills [6]. Scratch, one of the most widely used programming environments using functional programming approach, is a learning tool with a drag-and-drop interactive environments [7]. But a simple interface of drag-and-drop interaction is not enough, and it may lead students to build without considering reusability, so in the programming learning system, computational thinking as an important part is introduced, students can design their own solutions [8]. The C language e-learning platform developed by the team of Munich University of Technology embeds a parameter input window and an output window right after the editor, the programmed code may be saved, executed and verified during the execution, and writes the compiler results back to the user’s screen in the browser [9]. The results show that students can solve practical tasks actively. By changing the initial conditions and comparing the results of practice with the expected results, free experimentation and reflection could be achieved [10].

The integration of computer games into the learning system has been verified by a number of studies as a student-centered learning platform. Educational computer game will provide an interaction context for the students. Role-playing game enable students to collect necessary knowledge in the course of games to solve the problems in learning object-oriented programming, and students could get back the feedback or response immediately [11]. Students can easily understand concepts through participation and interaction. Studies have shown that by analyzing the design of tutorial components and entertainment components, in contrast to games, the learning environment is characterized by extensive learning support and an obvious programming focus [12]. At the same time, timely feedback can improve students’ enthusiasm for learning. In the research of Intelligent Tutoring System Based on flow chart, a Tic-tac-toe online game is designed, which applies the decision process of Bayesian network. Students interested interact with the game and get back the feedback or response immediately. The results show that providing feedback information is more conducive to improving students’ knowledge acquisition through the learning process [13].

From the above related work, it is important for students to acquire important knowledge concepts, to write core code independently, to compile feedback results in real time and visually display the results. Therefore, the VR learning platform designed in this paper allows students to learn VR knowledge points on the website, download the programming plugin through the website, and then carry out intuitive C# programming. Through this learning process, students can understand the core codes, master the overall coding situation, and improve their abilities of problem solving. At the same time, it can reduce students’ learning pressure and tension, and has a positive impact on students’ learning process in a more attractive virtual learning environment.

3. System Framework

The system is mainly divided into two modules, namely the website module C# programming module, shown in Figure 1. The website module includes the home page and the page presenting knowledge points of VR programing. The

Figure 1. Framework of the system.

home page provides the programming package the learners can directly download. The C# programming package mainly includes a C# console compiler and a 3D scene which can dynamically response to the C# codes.

The programming package interactions with the console program through Socket communication. Students write code in the code edit box, and then send it to the console program for compilation through Socket communication. If a compilation error occurs, the error message is returned to the programming package and shown in the code edit box. If the compilation is successful, the console program compiles the code into a DLL file, and then returns the successful result to the learning platform.

3.1. C# Programming Module

As a learning platform, a clear and concise graphic user interface (GUI) of C# programming module will help improve the learning experience for students. A screen shot of this GUI is shown in Figure 2, which includes a 3D virtual scene built by using UGUI technology of Unity 3D according to the corresponding learning contents, a code editing box, buttons for help linking.

Socket communication realizes the exchange of data between two applications on the network through a two-way communication connection. Here, the C# console module is used as the local server side of socket communication, and run to compile the codes from Unity 3D. Socket technology is used to realize the functionality of receiving and sending data on the server side, and then a class of compiling code and the method of compiling function are redefined. The server side receives the string code from Unity 3D and passes it into the method to compile the code. The compilation results are returned regardless of whether there is a compilation error.

Figure 2. A screen shot of the GUI for C# programming module.

3.2. Website Home Page

The website provides learners with an entrance to start the process of learning, including “Home”, “Unity 3D”, “C#” and “Download”. “Unity 3D” provides main contents of Unity 3D knowledge. On “Home”, students will see a video of instructions for the steps of programming, and then can click the "Download" button (shown in Figure 3) to download the C# programming package.

3.3. Knowledge Points Webpage

The “Unity 3D” button presents the text reading about the learning content, and through which the students can choose one topic to begin with his learning. At this moment, a new page called “Knowledge Points Webpage” (shown in Figure 4), and the students can read the corresponding knowledge. The virtual 3D scene in C# programming module (shown in Figure 2) corresponds to a knowledge point. Each knowledge point webpage generally introduces the principle, and then shows the relevant example code and the 3D dynamic effect diagram. Finally, there are links to blog posts related to this knowledge point.

4. The Implementation and Results

In this section, we introduce the implementation of the learning system based on the design framework described above. Unity 3D is currently a popular development engine in the field of VR, and it is based on the concept of component. Therefore, it is very important for students to understand and master these various components. Here, the transform of 3D game objects is chosen as the learning content of this system to describe the system implementation. Through learning, students should understand the concepts and master the concerned C# programming to control the transform of 3D game objects in different coordinate systems.

Figure 3. Website homepage of the learning system.

The learning process is shown in Figure 5. The first step of a usual learning process is to download and run the C# programming module, making it ready for code writing. As the second step, the students then open the reading materials to learn the knowledge points. The third step, which is also the most significant step, is to practice the C# programming according to the basic principle, for example, the transform method of game objects in 3D scenes. At this step, the students can correct their codes step by step under the tutoring provided by the system until the compilation success is achieved (shown in Figure 6). Then, the students can modify the codes and watch the 3D scene to understand how it works, as shown in Figure 7.

Figure 4. Webpage for knowledge points corresponded with the learning contents.

Figure 5. Learning process.

(a) (b)

Figure 6. (a) Error information when the code is compiled error; (b) Feedback information when the code is compiled successfully.

Figure 7. 3D presentation for the results of C# programming.

5. Conclusions

Real-time compiling of source codes to control and watch the game objects in the 3D scene is proposed in this paper for the VR learning. Through combining knowledge points and C# programming practices into the same learning platform, this system can greatly improve the learning efficiency and enthusiasm of the students.

The development of this learning system is at the beginning stage. Our future work will be focused on three aspects: 1) expanding the learning contents to cover all of basic knowledge for VR programming; 2) designing an intelligent tutoring module and further enhancing the interaction between the platform and students; 3) embedding the C# programming module into the webpage to realize the online programming.


This work is supported by “Guangdong Innovation Program for Postgraduate Education (No.2017SFKC-01)”.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.


[1] Lei, Z., Zhou, H., Hu, W., Deng, Q., Zhou, D. and Liu, Z. (2017) HTML5-Based 3D Online Control Laboratory with Virtual In-teractive Wiring Practice. IEEE Transactions on Industrial Informatics, PP, 1-1.
[2] Garcia-Zubia, J., Cuadros, J., Romero, S., Hernandez-Jayo, U., Ordu-a, P., Guenaga, M., et al. (2017) Empirical Analysis of the Use of the VISIR Remote Lab in Teaching Analog Electronics. IEEE Transactions on Education, PP, 1-8. https://doi.org/10.1109/TE.2016.2608790
[3] Callaghan, M.J., Mccusker, K., Losada, J.L., Harkin, J. and Wilson, S. (2013) Using Game-Based Learning in Virtual Worlds to Teach Electronic and Electrical Engineering. IEEE Transactions on Industrial Informatics, 9, 575-584. https://doi.org/10.1109/TII.2012.2221133
[4] Hsu, C.C. and Wang, T.I. (2018) Applying Game Mechanics and Stu-dent-Generated Questions to an Online Puzzle-Based Game Learning System to Promote Algorithmic Thinking Skills. Com-puters & Education. https://doi.org/10.1016/j.compedu.2018.02.002
[5] Mutiawani, V. and Juwita (2015) Developing E-Learning Applica-tion Specifically Designed for Learning Introductory Programming. International Conference on Information Technology Systems and Innovation, 126-129.
[6] Chen, W.K. and Cheng, Y.C. (2007) Teaching Object-Oriented Programming Laboratory with Computer Game Programming. IEEE Transactions on Education, 50, 197-203. https://doi.org/10.1109/TE.2007.900026
[7] Topalli, D. and Cagiltay, N.E. (2018) Improving Programming Skills in Engineering Education through Problem-Based Game Projects with Scratch. Computers & Education, 120, 64-74. https://doi.org/10.1016/j.compedu.2018.01.011
[8] Kazimoglu, C., Kiernan, M., Bacon, L. and Mackinnon, L. (2012) A Serious Game for Developing Computational Thinking and Learning Introductory Computer Programming. Procedia—Social and Behavioral Sciences, 47, 1991-1999. https://doi.org/10.1016/j.sbspro.2012.06.938
[9] Vogel-Heuser, B., Rehberger, S., Gramss, D. and Mayer, F. (2015) Integrating Lab-Size Automation Plants into a Web-Based E-Learning Environment for Teaching C Programming in Teams. IFAC Papersonline, 48, 295-300. https://doi.org/10.1016/j.ifacol.2015.11.251
[10] Vosinakis, S., Anastassakis, G. and Koutsabasis, P. (2018) Teaching and Learning Logic Programming in Virtual Worlds Using Interactive Microworld Representations. British Journal of Educational Technology, 49.
[11] Seng, W.Y. and Yatim, M.H.M. (2014) Computer Game as Learning and Teaching Tool for Object Oriented Programming in Higher Education Institution. Procedia—Social and Behavioral Sciences, 123, 215-224. https://doi.org/10.1016/j.sbspro.2014.01.1417
[12] Laporte, L. and Zaman, B. (2017) A Comparative Analysis of Pro-gramming Games, Looking through the Lens of an Instructional Design Model and a Game Attributes Taxonomy. Entertain-ment Computing, 25.
[13] Hooshyar, D., Ahmad, R.B., Yousefi, M., Fathi, M., Horng, S.J. and Lim, H. (2016) Applying an Online Game-Based Formative Assessment in a Flowchart-Based Intelligent Tutoring System for Improving Problem-Solving Skills. Computers & Education, 94, 18-36. https://doi.org/10.1016/j.compedu.2015.10.013

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.