22
votes
Unity Method count exceed the limit of 64K
This answer relies heavily on Android's official documentation (the quoted parts, specifically).
How to setup Multidex Support for Unity Project
What is Multidex:
Android application (APK) files ...
11
votes
Accepted
Does Unity let you code in Java?
Java is not supported by Unity. You should check out C#, however; it's a very similar language that takes a lot of influence from Java while arguably smoothing out some of the rougher edges of the ...
11
votes
Accepted
How do I define a required component on a Unity game object?
Applying the RequireComponent decoration to a script will ensure that the GameObject has the specified component.
If the component is missing:
Unity will attempt ...
9
votes
Accepted
How to keep a round body rotating without rotating it's center
Have your gameobject hierarchy like so:
STAR
- FACE
- BODY
Then rotate the Body of the star. Your face and body will be two seperate entities of course, ...
8
votes
How do C# and UnityScript differ in Unity development?
The very first question all beginning Unity developers have is C# or JS.
Always go with C#.
Now, right now you may be thinking, "But I don't want to learn C# and I already know a bit of JavaScript."
...
8
votes
Accepted
How do I get mouse x / y of the world plane in Unity?
Instead of using a collider for your terrain, you can also use a plane to perform a raycast. For example, if your grid is situated on the XZ plane, you can do something like this:
...
8
votes
Accepted
Multiple Scripts versus single script
I'd like to separete these things due to clearity reasons but I wonder
if calling different FixedUpdate() functions would imply some kind of
issue. For example: is their execution ensured to be ...
6
votes
How to compress Unity apk output?
You can compress certain assets individually.
After building the project, go into the log file and there will be a summary of what assets were packaged with the apk, and their sizes.
(On windows, ...
6
votes
Accepted
6
votes
Accepted
How to avoid Walls in A*
Add a restriction to the tiles your A* algorithm is able to consider and this will eliminate the undesired diagonals.
You wish to remove prevent two things from occurring, the first is you do not ...
6
votes
Accepted
Update and FixedUpdate together
Update Order
When you’re keeping track of game logic and interactions, animations, camera positions, etc., there are a few different events you can use. The common pattern is to perform most tasks ...
5
votes
How to increase the game "level" after certain amount of objects spawned?
Well the totalShots value stays at 10 until you increase it, so totalShots % 10 == 0 will continue to be true until you ...
5
votes
Accepted
5
votes
Accepted
2D Boat controlling physics
The simplest, modestly realistic, model I can think of would be parameterized by the following:
Mz The Turning Moment of the ship about the steering (ie Z or yaw) axis;
L/2 The distance of the ...
5
votes
Accepted
5
votes
Accepted
How does Color.Lerp works?
Color.Lerp in Unity works just as any lerp implementation, which works like this:
...
5
votes
How to move a object to a target point like sine wave in 2D world
I'm going to explain as much as I can to avoid more questions.
Let's begin from the simple linear motion. It's something like:
...
5
votes
Accepted
Minigame inside game in Unity
You can load a scene without destroying anything in the current scene by using the method SceneManager.LoadScene with the ...
5
votes
Converting UnityScript code to C#: What is the alternative for .ToBuiltin?
In Unity's JavaScript implementation (sometimes called UnityScript), there are two types of array: JavaScript-style arrays, which have no particular type or length, and "Builtin" (native ....
5
votes
Accepted
C# invoke stops unity
The label and goto in your FixedUpdate method is an infinite loop equivilent to:
...
5
votes
Accepted
Random Range Without Duplicates
Common approach
Shuffle your array. A simple Fisher–Yates shuffle will do. The result is that you will have your array of GameObject in a random order.
When ...
4
votes
Accepted
Retrieve the original prefab from a game object
Simple Answer
Use a class to load the original prefab from Resources.Load(string prefabPath, typeof(GameObject));
Store this returned prefab into a resource pool ...
4
votes
Does Unity let you code in Java?
Unity supports only C#, JavaScript and BooScript for scripting. However as Philipp mentioned,...
4
votes
Accepted
Unity's StartCoroutine funtionality inside a .NET Library and outside a MonoBehaviour
Yes, it is possible to do using iterators. I've put some pseudo C# code here to give you an idea. You use yield return to return something from an iterator, which ...
4
votes
Accepted
How can I merge multiple sprite into one sprite or texture using Unity3d?
You can use a RTT (render-to-texture) and a custom camera to one-shot render to it to merge all the layers using the GPU.
You can then save and use the resulting texture.
http://docs.unity3d.com/...
4
votes
Accepted
Checking if object passed between two other objects
You can use vectors, they're quite handy in fact. Oddly enough you'll need to use 3D vectors to accomplish this 2D task, but it's all rather straight forward.
First let's look at how to figure out if ...
4
votes
Insert 3d text to the front face of a cube GameObject
I think understand this question well enough to answer it and a year old (old questions deserve some love too).
Simply adding the TextMesh component to the cube is insufficient, as the text mesh has ...
4
votes
Accepted
Multiple enemy collidiers
First its good to note the difference between Colliders and Triggers
Colliders - generally are intended to represent physics interactions, so objects "colliding with them" should not pass through one ...
4
votes
How to apply a script to multiple Objects in Unity?
Here are the steps for applying scripts to multiple objects.
Step 1. Select all your objects from Hierarchy panel.
Step 2. Then from ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unityscript × 332unity × 308
c# × 90
2d × 25
javascript × 17
android × 13
movement × 9
gui × 9
raycasting × 9
physics × 8
animation × 8
scripting × 8
unity-networking × 7
collision-detection × 6
camera × 6
java × 5
game-design × 5
3d × 4
ai × 4
visual-studio × 4
navmesh × 4
procedural-generation × 3
gameobject × 3
text × 3
frame-rate × 3