Unity is a cross-platform game engine developed by Unity Technologies, which is primarily used to develop video games and simulations for computers, consoles, and mobile devices.
Unity offers a powerful rendering engine and a comprehensive set of tools and features for creating interactive 3D content, making it a popular choice among game developers.
Unity is a complex system of various modules and packages:
Getting Started with Unity
There are quite a number of “Getting started with Unity” on other sites. We are working on creating our own, please check back soon.
Unity Shortcut Keys
CTRL + P = Play
CTRL + SHIFT + P = Pause
SPACEBAR Maximus panel
Editor Navigation
Right click + WASD = FPS movement
GUI Text
Import the Font you want to use.
Note: Normal Windows Fonts are located under Windows->Fonts
With the Font selected click Menu->Game Object->Create Other->GUI Text
A new GUI text will be created.
GUI works only on X and Y, if you want to place an object in front of another object. Use Z for Order (Higher numbers are on top)
GUI Texture
Import a PNG file to use with the GUI Texture
Select the newly imported file, then click Menu->Game Object->Create Other->GUI Texture
A new GUI texture will be created from the PNG file.
Scale to full screen
UIText and GUITexture uses ViewPort space.
Pixel Inset
x = 0
y = 0
width = 0
height = 0
Scale
x = 1
y = 1
3D Text
Menu->Game Object->Create Other->3D Text
Replace the default font, with the font you wish to use.
The text will most likely be distorted when you the any other Font other than arial.
To fix this:
Select the 3D text, under “Mesh Renderer” replace “font material” with the font material on your imported Font.
Now, it will be blurry:
To fix this:
Change the Font size to a bigger number
Go to 3D text and change the Character size to a smaller number.
Adjust the size till you are happy.
To make the 3D text selectable, add Menu->Component->Physics->Box Collider
Scripts:
Changing textures
guiTexture.texture = newTexture;
GameObject.Find(“levelGUI”).GetComponent(GUITexture).enabled = false;
[ExecuteInEditMode]
public enum RuntimePlatform
{
OSXEditor = 0,
OSXPlayer = 1,
WindowsPlayer = 2,
OSXWebPlayer = 3,
OSXDashboardPlayer = 4,
WindowsWebPlayer = 5,
WiiPlayer = 6,
WindowsEditor = 7,
IPhonePlayer = 8,
PS3 = 9,
XBOX360 = 10,
Android = 11,
NaCl = 12,
LinuxPlayer = 13,
}
C# Scripts:
Script to open doors:
void OnControllerColliderHit(ControllerColliderHit hit)
{
if (hit.gameObject.tag == “door”)
{
Door(doorOpenSound, true, “dooropen”, currentDoor);
}
}
void Door(AudioClip clip, bool isOpen, String animationName, GameObject theDoor)
{
audio.PlayOneShot(clip);
theDoor.transform.parent.animation.Play(animationName);
}
Ray Casting
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(transform.position, transform.forward, out hit, 5))
{
if (hit.collider.gameObject.tag == “door”)
{
//Do whaterver here
//Play door open sound, animation, etc…
}
}
Triggers
void OnTriggerEnter(Collider collisionInfo)
{
if(collisionInfo.gameObject.tag == “healtBar”)
{
health++;
Destroy(collisionInfo.gameObject);
}
}
Rotation script:
1 | transform.Rotate(new Vector3(0,rotationAmount,0)); |
Remove object after a time
1 | void Start() |
Networking
1 | public class Connect : MonoBehaviour |
Application.CaptureScreenshot(“Screenshot.png”);
Adding Grass
Tile Size 15 x 15
Adding Cliff
Tile Size 70 x 70
Adding Trees
Bend Factor: trees to sway in wind, make it 2.
Brush size: 15, painting 15 trees at a time.
Tree Density: 0 Wide spread of trees
Color Variation 0.4
Tree Height/Width: 1.5
Adding Grass (moving)
Brush size: 100
Opacity: 0.05
Target Strength: 0.6
Adding the “sun”
Directional Light:
Flare->Sun
Rotate it to fit Skybox
Adding Sounds
Stereo -> Constant Volume
Mono -> Variable Volume
In game music should be stereo
WAV, MP3, AIFF, OGG
Add audio source to object
Adding Background (Skybox)
Edit->Render Settings
Intersecting Lines
public static MapPoint IntersectionPoint(Polyline firstLine, Polyline secondLine)
{
MapPoint mp = null;
ESRI.ArcGIS.Client.Geometry.PointCollection pointsLine1 = firstLine.Paths[0];
ESRI.ArcGIS.Client.Geometry.PointCollection pointsLine2 = secondLine.Paths[0];
MapPoint firstLineStartPos = pointsLine1[0];
MapPoint firstLineEndPos = pointsLine1[1];
MapPoint secondLineStartPos = pointsLine2[0];
MapPoint secondLineEndPos = pointsLine2[1];
double Ua, Ub;
// Equations to determine whether lines intersect
Ua = ((secondLineEndPos.X - secondLineStartPos.X) * (firstLineStartPos.Y - secondLineStartPos.Y) - (secondLineEndPos.Y - secondLineStartPos.Y) * (firstLineStartPos.X - secondLineStartPos.X)) /
((secondLineEndPos.Y - secondLineStartPos.Y) * (firstLineEndPos.X - firstLineStartPos.X) - (secondLineEndPos.X - secondLineStartPos.X) * (firstLineEndPos.Y - firstLineStartPos.Y));
Ub = ((firstLineEndPos.X - firstLineStartPos.X) * (firstLineStartPos.Y - secondLineStartPos.Y) - (firstLineEndPos.Y - firstLineStartPos.Y) * (firstLineStartPos.X - secondLineStartPos.X)) /
((secondLineEndPos.Y - secondLineStartPos.Y) * (firstLineEndPos.X - firstLineStartPos.X) - (secondLineEndPos.X - secondLineStartPos.X) * (firstLineEndPos.Y - firstLineStartPos.Y));
if (Ua >= 0.0f && Ua <= 1.0f && Ub >= 0.0f && Ub <= 1.0f)
{
double x = firstLineStartPos.X + Ua * (firstLineEndPos.X - firstLineStartPos.X);
double y = firstLineStartPos.Y + Ua * (firstLineEndPos.Y - firstLineStartPos.Y);
mp = new MapPoint()
{
X = x,
Y = y
};
}
return mp;
}
Middle Point of a line:
double x = (X1 + X2) / 2;
double y = (Y1 + Y2) / 2;
Lightmapping
Set camera to deferred lighting on PRO
set camera to vertex lit on FREE and mobile
lightmapping does not affect batch.
lightmapping has more textures, so longer load times
use dual lightmaps
Courses
Unity Learn
- Introduction to Visual Scripting
- Practical Game Accessibility
- John Lemon’s Haunted Jaunt 3D Beginner
- Intermediate Scripting
- VR Beginner The Escape Room
LinkedIn Learning Unity Courses
2016
2014
Resources
https://blog.unity.com/technology/prefabs-whats-new-2022-2
https://www.youtube.com/channel/UCxBaTADLh3uUKhmP1cQ7ddg/videos
Becoming Better at Unity
- linear algebra
- probability theory
- write your own game engine
Play around with Unity Playground
https://unity3d.com/learn/tutorials/s/unity-playground
https://docs.unity3d.com/Manual/AdvancedDevelopment.html
https://docs.unity3d.com/Manual/class-ScriptableObject.html
https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html
http://www.what-could-possibly-go-wrong.com/promises-for-game-development/
http://www.what-could-possibly-go-wrong.com/about/
https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)
https://github.com/Real-Serious-Games/c-sharp-promise
https://catlikecoding.com/unity/tutorials/
https://gist.github.com/luke161
https://thoughtbot.com/blog/avoiding-out-of-memory-crashes-on-mobile
https://thoughtbot.com/blog/an-introduction-to-webgl
https://answers.unity.com/questions/300841/ios-download-files-and-store-to-local-drive.html
https://answers.unity.com/questions/322526/downloading-big-files-on-ios-www-will-give-out-of.html
https://answers.unity.com/questions/970806/download-images-from-url-save-to-device-load-into.html
DOTS
Data-Oriented Technology Stack (DOTS)
https://www.reddit.com//r/gameDevClassifieds/wiki/programmers
Complete C# Unity Developer 2D – Learn to Code Making Games (Udemy)
https://digitaldefynd.com/best-unity-courses/#1_Complete_C_Unity_Developer_2D_Learn_to_Code_Making_Games_UdemyComplete C# Unity Developer 3D – Learn to Code Making Games (Udemy)
https://digitaldefynd.com/best-unity-courses/#2_Complete_C_Unity_Developer_3D_Learn_to_Code_Making_Games_UdemyUnity Game Dev Courses: Fundamentals (Pluralsight)
https://digitaldefynd.com/best-unity-courses/#3_Unity_Game_Dev_Courses_Fundamentals_PluralsightUnity Certification : C# Programming for Unity Game Development (Coursera)
https://digitaldefynd.com/best-unity-courses/#4_Unity_Certification_C_Programming_for_Unity_Game_Development_CourseraRPG Core Combat Creator – Learn Intermediate Unity C# Coding
https://digitaldefynd.com/best-unity-courses/#5_RPG_Core_Combat_Creator_Learn_Intermediate_Unity_C_CodingThe Ultimate Guide to Game Development with Unity (Udemy)
https://digitaldefynd.com/best-unity-courses/#6_The_Ultimate_Guide_to_Game_Development_with_Unity_UdemyComplete Blender Creator Course (Udemy)
https://digitaldefynd.com/best-unity-courses/#7_Complete_Blender_Creator_Course_UdemyGame Development Certification by Michigan State Univ (Coursera)
https://digitaldefynd.com/best-unity-courses/#8_Game_Development_Certification_by_Michigan_State_Univ_CourseraUnity Gameplay Programmer Certification Preparation Course (Coursera)
https://digitaldefynd.com/best-unity-courses/#9_Unity_Gameplay_Programmer_Certification_Preparation_Course_CourseraUnity Certified Programmer Exam Preparation Course (Coursera)
https://digitaldefynd.com/best-unity-courses/#10_Unity_Certified_Programmer_Exam_Preparation_Course_Coursera
Bonus Courses
https://digitaldefynd.com/best-unity-courses/#Bonus_Courses
https://catlikecoding.com/unity/tutorials/
Code Monkey (YouTube)
https://www.youtube.com/channel/UCFK6NCbuCIVzA6Yj1G_ZqCg
Unity Learn
https://blogs.unity3d.com/2019/04/29/announcing-unity-learn-a-brand-new-learning-platform/
https://blogs.unity3d.com/2019/06/27/introducing-unity-learn-premium/
freecodecamp
coursera
Programming for Everybody (Getting Started with Python)
https://www.coursera.org/learn/python
https://www.coursera.org/learn/competitive-strategy
udacity
How to Build a Startup
https://www.udacity.com/course/how-to-build-a-startup--ep245
Startup
http://startupclass.samaltman.com/
udemy
This Is How You Make iPhone Apps - iOS Development Course
https://www.udemy.com/iosdevelopment/learn/lecture/101033#overview
Getting Started with Google Analytics
https://www.udemy.com/getting-started-with-google-analytics/learn/lecture/129503#overview
Unity Learn
https://www.youtube.com/watch?v=qipYRdaNWZY
https://www.youtube.com/watch?v=iEzGn_dX-J4
3D Kit
https://www.youtube.com/watch?v=JpdQqytJiDo
Creator Kit: Puzzle
https://learn.unity.com/project/creator-kit-puzzle
Creator Kit: RPG
https://learn.unity.com/project/creator-kit-rpg
Creator Kit: FPS
https://learn.unity.com/project/creator-kit-fps
https://cgcookie.com/articles/30-things-every-unity-developer-should-know