کانال تخصصی یونیتی ( آموزش و نکته )
Kanalga Telegram’da o‘tish
به نام خدا مسئولیت مطالب یا آگهی ارسالی در کانال یا کامنت ها به عهده من یا ما نیست لیست گروه ها و... https://t.me/UnityEngine3D/823 برای تبلیغ در کانال و گروه : https://t.me/UnityEngine3DAds مدیر اصلی(مالک) @UnityEngine
Ko'proq ko'rsatish1 763
Obunachilar
+324 soatlar
+77 kunlar
+2030 kunlar
Postlar arxiv
Did you ever tried to set Unitys LayerMask to 'Everything' in code?
Use the bitwise NOT operator (it is ~ in C#).
Like this: LayerMask mask = ~0;
This corresponds to everything
Another good use of the NOT operator in our example picture
#نکته #یونیتی
👉 @UnityEngine3D 👈
Have you used the “Event Trigger” component in Unity yet? Add it to your GameObjects, and you can detect & respond to clicks, drags, and more with ease!
#نکته #یونیتی
👉 @UnityEngine3D 👈
How to avoid infinite if statements? ❌
Use interfaces like this! ✅
Much cleaner and readable!
#نکته #یونیتی
👉 @UnityEngine3D 👈
How to avoid infinite if statements? ❌
Use interfaces like this! ✅
Much cleaner and readable!
#نکته #یونیتی
👉 @UnityEngine3D 👈
With custom editor tools, you can streamline your workflow, improve your team's productivity, and create a more intuitive and user-friendly development environment.
تعیین قالب پیشفرض اسکریپت های جدید در یونیتی
وقتی داخل یونیتی یه اسکریپت جدید ایجاد میشه اون اسکریپت بر پایه قالب پیشفرض یونیتی یه کد اولیه داره که توش متد های start و update و یه سری using های ابتدای کد هست
یونیتی به شما این امکان رو میده که قالب پیشفرض اسکریپت های MonoBehaviour و همچنین شیدر ها و یه سری کد های دیگه رو ویرایش کنید
به توصیه یونیتی استفاده از یک هدر استاندارد و ثابت که بالای هر اسکریپتتون باشه توصیه میشه، اینطوری وقتی کسی به اون اسکریپت رجوع میکنه میدونه هدف کد چیه و مثلا توی چه تاریخی ایجاد شده و ..
A standard header is also recommended. Including a standard header in your code template helps you document the purpose of a class, the date it was created, and even who created it; essentially, all of the information that could easily get lost in the long history of a project, even when using version control.
مسیر قالب پیشفرض اسکریپت های یونیتی در ویندوز
[UNITY FOLDER]\Data\Resources\ScriptTemplates
در مک:
Applications/Hub/Editor/[version]/Unity/Unity.app/Contents/ Resources/ScriptTemplates
داخل این پوشه فایل قالب های مختلف رو میبینید که برای اسکریپت های MonoBehavour این فایل نقش قالب رو ایفا میکنه:
81-C# Script-NewBehaviourScript.cs.txt
مثلا با ویرایش اسکریپت به این شکل میتونید کاری کنید که با ایجاد اسکریپت های مونو جدید بالاش یه کامنت میذاره تا توضیحات مربوط به اون اسکریپت رو وارد کنیم
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*----------------------------------
----------------------------------
Creation Date: #DATETIME#
Author: #DEVELOPER#
Description:
----------------------------------
----------------------------------
*/
public class #SCRIPTNAME# : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
#NOTRIM#
}
// Update is called once per frame
void Update()
{
#NOTRIM#
}
}
بدیهیه که میتونید حتی متد های پیشفرض مثل Start و Update رو حذف یا اضافه و کامنتشون رو تغییر بدید
طبق گفته یونیتی اگه توی پوشه Assets یه پوشه جدید ایجاد کنید با عنوان ScriptTemplates میتونید قالب رو اختصاصی هر پروژتون ایجاد کنید
نکته: شاید همه راحت نباشن که توی همه فایلهاشون این کامنت باشه اما دونستن کلی این ساز و کار ممکنه در آینده بدردتون بخوره،مثلا در حال آماده کردن یه پروژه بزرگید و میدونید بعدا با زیاد شدن اسکریپت هاش به همچین چیزی نیاز پیدا میکنید
این پست برگرفته از یه پست آموزشی خیلی خوب از سایت خود یونیتی هست که میتونید توضحات کاملتر چیزی که خوندید و یه سری نکته برای بهتر سازماندهی کردن پروژه های یونیتی هم داخلش پیدا کنید:
https://unity.com/how-to/organizing-your-project#code-standards
#آموزش #یونیتی #ارسالی_اعضا
👉 @UnityEngine3D 👈
راهنمای آموزش نصب یونیتی :
یونیتی را نصب کنید
❌ کپی از این آموزش پیگرد قانونی دارد ❌
Mix different math expressions, along with 'L' (linear) and 'R' (random), in the Unity inspector transform fields to come up with interesting object placement patterns. https://docs.unity3d.com/Manual/EditingValueProperties.html
#نکته #یونیتی
👉 @UnityEngine3D 👈
Use ProfilerMarker to mark up script code blocks for the Profiler.
The information is then displayed in the CPU Profiler & can be also captured with Recorder.
This helps to get performance overview of different parts of code and identify issues.
#نکته #یونیتی
👉 @UnityEngine3D 👈
Use the SelectionBase attribute if your game object has children. This makes it easier to select in the scene view
#نکته #یونیتی
👉 @UnityEngine3D 👈
Playing your scene in the #unity3d editor, but forgot to select "Maximize On Play", e.g.? No need to restart! You can pause, change settings and hit play. Use Ctrl+P to play, Ctrl+Shift+P to pause, and Ctrl+P during play mode to stop
#نکته #یونیتی
👉 @UnityEngine3D 👈
Brighten up your Debug.Log output with some rich text! Unity supports "b", "i", "color" and "size" markup tags in your text. I use extension methods to simplify usage
#نکته #یونیتی
👉 @UnityEngine3D 👈
You can 𝗮𝗱𝗱 𝗕𝘂𝗹𝗹𝗲𝘁 𝗛𝗼𝗹𝗲𝘀 or 𝗦𝘁𝗶𝗰𝗸𝗲𝗿𝘀 to your game by using 𝗗𝗲𝗰𝗮𝗹 𝗥𝗲𝗻𝗱𝗲𝗿𝗲𝗿 𝗙𝗲𝗮𝘁𝘂𝗿𝗲 in a URP project!
Here is detailed explanation:
https://www.sunnyvalleystudio.com/blog/unity-decal-bullet-holes-stickers
#نکته #یونیتی
👉 @UnityEngine3D 👈
You can use 𝗖𝗼𝗹𝗹𝗱𝗶𝗲𝗿𝟮𝗗.𝗖𝗮𝘀𝘁(..) / Rigidbody2D.Cast(...) 𝘁𝗼 𝗱𝗲𝘁𝗲𝗰𝘁 𝗰𝗼𝗹𝗹𝗶𝘀𝗶𝗼𝗻 when creating custom movement system for your game
Great live training video about it: https://youtu.be/wGI2e3Dzk_w
#نکته #یونیتی
👉 @UnityEngine3D 👈
Use the C# 7 [field: SerializeField] attribute to see a property backing field in the Unity inspector.
[field: SerializeField]
public bool Repeat { get; set; }
#نکته #یونیتی
👉 @UnityEngine3D 👈
Love C# events in Unity? Initialize them to avoid null-checking when you invoke them, e.g.:
public static event Action<float> OnHealthChanged = (health) => { };
...
OnHealthChanged(currentHealth/maxHealth);
#نکته #یونیتی
👉 @UnityEngine3D 👈
Use the FormerlySerializedAs attribute if you need to change a property on a MonoBehaviour but don't want to lose existing values.
#نکته #یونیتی
👉 @UnityEngine3D 👈
Implement OnValidate() to limit the range of values your properties accept in the inspector
You can adjust stack trace logging at runtime. E.g. call Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None) and Debug.Log will not output the stack trace
#نکته #یونیتی
👉 @UnityEngine3D 👈
Endi mavjud! Telegram Tadqiqoti 2025 — yilning asosiy insaytlari 
