السكربت في يونتي - unity 3d script - unity 3d

Опубликовано: 21 Март 2026
на канале: Rasha Saad aldeen
2,831
112

في هذا الفديو سنتعرف على مفهوم السكربت في يونتي حيث يمثل الكود البرمجي او المكان الذي نكتب فيه الكود البرمجي
The behavior of GameObjects is controlled by the Components that are attached to them. Although Unity’s built-in Components can be very versatile, you will soon find you need to go beyond what they can provide to implement your own gameplay features. Unity allows you to create your own Components using scripts. These allow you to trigger game events, modify Component properties over time and respond to user input in any way you like.

Learning the art of programming and the use of these particular languages is beyond the scope of this introduction. However, there are many books, tutorials and other resources for learning how to program with Unity. See the Learning section of our website for further details.

Creating Scripts
Unlike most other assets, scripts are usually created within Unity directly. You can create a new script from the Create menu at the top left of the Project
The new script will be created in whichever folder you have selected in the Project panel. The new script file’s name will be selected, prompting you to enter a new name.
A script makes its connection with the internal workings of Unity by implementing a class which derives from the built-in class called MonoBehaviour. You can think of a class as a kind of blueprint for creating a new Component type that can be attached to GameObjects. Each time you attach a script component to a GameObject, it creates a new instance of the object defined by the blueprint. The name of the class is taken from the name you supplied when the file was created. The class name and file name must be the same to enable the script component to be attached to a GameObject.

The main things to note, however, are the two functions defined inside the class. The Update function is the place to put code that will handle the frame update for the GameObject. This might include movement, triggering actions and responding to user input, basically anything that needs to be handled over time during gameplay. To enable the Update function to do its work, it is often useful to be able to set up variables, read preferences and make connections with other GameObjects before any game action takes place. The Start function will be called by Unity before gameplay begins (ie, before the Update function is called for the first time) and is an ideal place to do any initialization.

Note to experienced programmers: you may be surprised that initialization of an object is not done using a constructor function. This is because the construction of objects is handled by the editor and does not take place at the start of gameplay as you might expect. If you attempt to define a constructor for a script component, it will interfere with the normal operation of Unity and can cause major problems with the project.

لمحة:
قناتي متخصصة في البرمجة وتطوير الألعاب
استخدم محرك يونتي
انستغرام
  / rasha_saad_aldeen  
يوتيوب
   / rashasaadaldeen  
فيسبوك
  / rashasaadaldeenofficial  
دورة برمجة
   • برمجة لعبة قتالية ثلاثية الأبعاد - برمجة ا...  
برمجة الالعاب