With Mathf.InverseLerp you can map the real time minutes to your ingame days.
Use the passed time to inverse lerp between 0f and your ingame length of a day to use the result in a lerp between 0f and 24f to get a float holding the time of day.
#نکته #یونیتی
👉 @UnityEngine3D 👈
Use the passed time to inverse lerp between 0f and your ingame length of a day to use the result in a lerp between 0f and 24f to get a float holding the time of day.
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍1
You can create your own packages for your projects.
You need an entry in your manifest.json which is located in your Packages folder.
You also need a package.json file in the folder that holds your code.
#نکته #یونیتی
👉 @UnityEngine3D 👈
You need an entry in your manifest.json which is located in your Packages folder.
You also need a package.json file in the folder that holds your code.
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍1
Handle OnBecame[Inv|V]isible to avoid unnecessary work in scripts attached to game objects that are not in the camera view
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍1
Remove confusing indentations by getting rid of some nested if/else constructs.
Often the else statement is not needed & the code can be optimized to have less indentations & more readability.
Here is an easy example to show a use case
#نکته #یونیتی
👉 @UnityEngine3D 👈
Often the else statement is not needed & the code can be optimized to have less indentations & more readability.
Here is an easy example to show a use case
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍1
In a Unity scene, hold the 'V' key while the translate tool is active and you can drag an object by a vertex and snap that to one of another object's vertices
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
👌4
Speed up your Unity3d workflow by adding an Assembly Definition to script folders. Unity compiles these scripts into their own assembly, rather than Assembly-CSharp.dll, => shorter compile times!
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍2🤔1
As you develop your games, copy generic components and methods into a common library. You can then export this as a Unity package and import it into other projects. It also encourages a component approach to your coding.
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍1🔥1💔1
The MenuItem attribute can also be used to create a menu hierarchy and assign a key shortcut for your editor tools. % = Ctrl; # = Shift; & = Alt; _ = no modifier. See https://docs.unity3d.com/ScriptReference/MenuItem.html
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍1👏1
Setting Time.timeScale to 0 is an easy way to pause your game, but make sure your UI code doesn't rely on Time.deltaTime or WaitForSeconds(). Use Time.unscaledDeltaTime to avoid this issue
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
💯4⚡1
Did you know that you can have multiple scenes open in the Unity editor? Just drag your additional scenes into the hierarchy. Only one scene can be active. An easy way to compare scenes.
#نکته #یونیتی
👉 @UnityEngine3D 👈
#نکته #یونیتی
👉 @UnityEngine3D 👈
👍2