Questions tagged [unity]
Unity is a cross-platform game creation system that focuses on easy art pipeline process. It consists of a game engine and an integrated development environment. The game engine's scripting is built on Mono.
16,578
questions
111
votes
2
answers
41k
views
How can I create a "see behind walls" effect?
Divinity: Original Sin 2 has a beautiful see-through system. When I go behind walls, a splash mask will appear, and when I move around the game, it changes. It's like a dissolve shader, and has a ...
108
votes
6
answers
184k
views
What is the proper way to handle data between scenes?
I am developing my first 2D game in Unity and I have come across what seems an important question.
How do I handle data between scenes?
There seems to be different answers to this:
Someone mention ...
93
votes
3
answers
15k
views
How can I clean up excessive player-created rubble?
In my latest game I'm making, you can slice a 2D object arbitrarily, demonstrated in this gif:
You can continuously cut it into hundreds or thousands of pieces. This doesn't create a lot of lag, ...
81
votes
13
answers
113k
views
How do you handle aspect ratio differences with Unity 2D?
I've gotten a lot of answers to this question, but they are all generic and generally not very useful. None of the tutorials talk about aspect ratio and dealing with mobile devices and there are a ...
79
votes
10
answers
237k
views
In Unity, how do I correctly implement the singleton pattern?
I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating ...
76
votes
1
answer
24k
views
How can I make a "wet surface"/"shallow puddle" shader in Unity?
In my game I need to create dynamic water puddles but I cannot find a tutorial that shows how I can make such an effect (an example of which is shown below). How can I do it?
69
votes
1
answer
12k
views
How can I replicate Quantum Break's distortion particle effect?
Quantum Break has this fantastic particle effect, it's a distortion effect like broken glass. I want know how I can replicate this effect? You can see it below, and a full video is available on ...
65
votes
6
answers
64k
views
What are the pro/cons of Unity3D as a choice to make games? [closed]
We are doing our school project with Unity3d, since they were using Shiva the previous year (which seems horrible to me), and I wanted to know your point of view for this tool.
Pros:
multi platform, ...
49
votes
4
answers
17k
views
How can I completely hide and protect strings from the player in Unity?
I have been using Unity to create a 2D game which will be completely offline (which is the problem), the game-play needs you to enter certain strings at certain levels and Unity compiles to DLLs, ...
45
votes
2
answers
10k
views
How to render realistic ice?
I am trying to write an ice shader in Unity that looks good and at least semi-realistic.
If the following shot (found on Google) was CG, what would its shader include? (the foreground cave). I might ...
43
votes
4
answers
18k
views
What happens when Time.time gets very large in Unity?
As it is said here :
Time.time
The time at the beginning of this frame (Read Only). This is the time in seconds since the start of the game.
And as I know the time is stored in float. So, my ...
42
votes
1
answer
4k
views
Why use convex polygons and not concave ones in path-finding?
I read in Unity's path-finding documentation that they use convex polygons because there won't be any 'obstruction' between 2 points. Then they add their vertices as nodes along with starting and ...
42
votes
4
answers
74k
views
How to not freeze the main thread in Unity?
I have a level generation algorithm that is computationally heavy. As such, calling it always results in the game screen freezing. How can I place the function on a second thread while the game still ...
40
votes
7
answers
43k
views
How do idle games handle such large numbers?
Just wondering how games such as Tap titans and Cookie Clicker handle such large numbers.
I am trying to implement an idle game however the largest number format supported by C# is decimal.
I am ...
38
votes
8
answers
18k
views
Should I avoid using object inheritance as possible to develop a game?
I prefer OOP features when developing games with Unity. I usually create a base class (mostly abstracted) and use object inheritance to share the same functionality to the various other objects.
...
38
votes
2
answers
13k
views
How do I make a character capable of walking on walls?
I am trying to get a character to move like a spider: Given a rising slope which a ball would normally not be able to roll up, the spider would slowly crawl up.
Similarly, given a mid-air rectangular ...
37
votes
3
answers
68k
views
What happens if I make more than $100k with the free Unity license?
If an indie game developer makes more than $100,000 using the free version of Unity, what happens to the money that goes over $100k? How will Unity people come to know how much money they are making?
...
35
votes
9
answers
28k
views
I prefer C/C++ over Unity and other tools: is it such a big downer for a game developer? [closed]
We have a big game project using Unity at school. There are 12 of us working on it. My teacher seems to be convinced it's an important tool to teach students, since it makes students look from the ...
34
votes
6
answers
88k
views
Can I legally remove the default Unity splash screen by removing it from the APK?
While using Unity I export an Android game as an APK. When the APK is run, the first thing that is displayed is the Unity splash screen. I worked out that I could replaced that image by opening the ...
33
votes
4
answers
17k
views
How can I build a game in Unity with minimum/no use of the visual editor?
I'd like to write a game completely in C#. In my search for an engine, I found Unity3D, but all the tutorials and documentation are speaking about a visual editor and the Unity IDE in which you click ...
32
votes
2
answers
40k
views
How to upgrade a project in Unity Hub
Before Unity Hub, it used to be the case that if you opened up a project that was from an older version, you would be prompted to upgrade the project.
I am now on the latest Unity Hub 2.0.0 and I am ...
32
votes
3
answers
143k
views
Is it possible to use C++ with Unity instead of C#?
The title kind of says it all. Is it possible to replace C# with C++ on a game using Unity?
31
votes
7
answers
13k
views
Teamwork in Unity
I have a Unity project without any version control, and I need to share it with another developer so that both of us can work on the project.
What strategies should be use that play nice with Unity ...
30
votes
2
answers
72k
views
How to correctly draw a line in Unity
I'm working on a game which requires me to draw a few lines from a single point that is more formally said
Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates ...
30
votes
6
answers
44k
views
What is the most serious limitation of Unity? [closed]
Having read this heated question about Unity vs. UDK vs. ID something, I'm curious to know: what the repeatedly-hit, most crippling limitation(s) of Unity?
In order to keep this question non-...
29
votes
1
answer
7k
views
What is the standard practice for animating motion -- move character or not move character?
I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the ...
29
votes
3
answers
93k
views
What is the pixels to units property in Unity sprites used for?
I'm starting to learn Unity for 2D development.
So, I am importing several sprites into the game, and I couldn't help but notice that there is a "pixels to units" property, by default on ...
28
votes
5
answers
44k
views
When should I use velocity versus addForce when dealing with player objects?
I'm confused about these two methods in the Unity framework. Both make the player object move, stop, change direction, etc. When should one be used over the other and when is one appropriate?
28
votes
2
answers
20k
views
How can I reduce the performance impact of rendering trees?
I'm making a low poly stylized kind of game. I have a terrain with some water, and I want lots and lots of trees; I have 10,000 trees mass placed, at the moment. Each tree consists of no more than 200 ...
28
votes
8
answers
36k
views
Algorithm for creating spheres?
Does anyone have an algorithm for creating a sphere proceduraly with la amount of latitude lines, lo amount of longitude lines, ...
27
votes
8
answers
12k
views
How can I avoid tight script coupling in Unity?
Some time ago I started working with Unity and I still struggle with the issue of tightly coupled scripts. How can I structure my code to avoid this problem?
For example:
I want to have health and ...
27
votes
4
answers
30k
views
How do you save game state?
What is the procedure followed by game programmers for saving and resuming game state? like files/mappings. I want to save it for tower defense game and I am using unity3D game engine.
26
votes
7
answers
9k
views
Is the Microsoft recommendation to use C# properties applicable to game development?
I get that sometimes you need properties, like:
public int[] Transitions { get; set; }
or:
...
26
votes
4
answers
11k
views
How can I rotate an object based on another's offset to it?
I have a 3D model of a turret that con rotate around the Y-axis. This turret has a cannon that is significantly off the center of the object. I want the cannon, not the turret, to aim at a specified ...
26
votes
2
answers
6k
views
Using Quaternions: What can I do with them? (without the maths)
I am a Game Developer and did not study Mathematics. So I only want to use Quaternions as a tool. And to be able to work with 3D rotation, it's necessary to use Quaternions (Or Matrixes, but let's ...
26
votes
2
answers
53k
views
Difference between unity scripting backend IL2CPP and Mono2x
IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. Note - IL2CPP is only available when building for the following ...
26
votes
2
answers
4k
views
How do I run functional tests against my Unity3D game?
Context
I am continuing some legacy code for a game in Unity3d, and I want to write some functional tests meant for regression, to ensure I don't break things when implementing new things or when ...
25
votes
9
answers
17k
views
Best place for learning how to write games in Unity3d [closed]
What's the best place for tutorials & other learning resources for unity3d?
25
votes
3
answers
32k
views
What's the difference between UnityEngine.Random and System.Random?
What's the different between this
int randomNumber = UnityEngine.Random.Range(0, 10);
and this
...
24
votes
5
answers
14k
views
Why is an engine like Unity3D emphasized over a native library like OpenGL for beginners? [closed]
I am just a beginner in 3D games, my preferred platform is Android. I posted a question in some other forum about "What to use: OpenGL or Unity3d?" They all emphasized Unity3D and using its built-in ...
24
votes
5
answers
88k
views
How to detect collision occurring on a child object, from a parent script?
I have an enemy with this structure:
Enemy
Body
Head
Arm Left
Arm right
...and so on. I also have a collider for each part of the body.
In my "Enemy" object I've attached a script, and ...
24
votes
1
answer
6k
views
Why should I always consider creating and using object pools instead of instantiating the new object on the fly?
I have read about this pattern several times (from a best-practices perspective):
Memory Allocation: Instead of instantiating the new object on the fly, always consider creating and using object ...
24
votes
5
answers
41k
views
How can I make huge terrains in Unity?
How can I make extremely huge terrains in Unity? It seems like I can set width and length to large values. But the Heightmap resolution only goes up to 4097 and the Detail resolution only goes up to ...
23
votes
4
answers
9k
views
How to make AI detect a target behind a wall, who is only partially exposed?
I'm making an FPS game where, even when a target's whole body is behind a wall or box, but its finger or foot exposed, the AI should be able to detect it and shoot its finger.
So far the way I've ...
23
votes
1
answer
42k
views
How do I use Android's adaptive icons in Unity?
As of API 26, Android uses something called adaptive icons.
When targeting API 25 and lower, my app's icon looks fine:
But when targeting API 26+, it shows up in a white circle like so:
How can I ...
23
votes
4
answers
12k
views
Saving player's progress in a Unity game
I am making a game using the Unity game engine and I want to save the player's progress including level, experience points, chosen character, etc.
Presently I am using PlayerPrefs but I want to know ...
23
votes
2
answers
10k
views
How to design context menus based on whatever the object is?
I'm looking for a solution for a "Right Click Options" behaviour.
Basically any and every item in a game, when right clicked, can display a set of options based on whatever the object is.
Right ...
23
votes
4
answers
9k
views
Should a wall be created as a plane or as a box?
What are the benefits of a wall being as a plane or as a box? Should I use a plane with a box collider instead of mesh collider?
23
votes
1
answer
7k
views
How do I prevent inappropriate ads from appearing in my game?
My game implements Unity ads, and is designed with a universal audience in mind. As such, I would prefer not to have 18+ ads (or even 13+ ads depending on the circumstances) appearing in it, ...
23
votes
3
answers
6k
views
How can I implement a short-cut grass effect?
I've been looking at some screenshots from games like Rocket League and FIFA:
and I started wondering one would achieve the short-cut grass effect.
Is it a shader? Is it actual geometry? Or just ...