Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
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 ...
Rakesh's user avatar
  • 539
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, ...
jgallant's user avatar
  • 8,424
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 ...
Rakesh's user avatar
  • 539
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: ...
Ocelot's user avatar
  • 1,433
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 ...
Philipp's user avatar
  • 120k
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 ....
DMGregory's user avatar
  • 135k
5 votes
Accepted

C# invoke stops unity

The label and goto in your FixedUpdate method is an infinite loop equivilent to: ...
dfkeenan's user avatar
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 ...
Theraot's user avatar
  • 26.9k
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 ...
Draco18s no longer trusts SE's user avatar
4 votes
Accepted

How to make the wheels rotate depending on the speed of the vehicle

When you are using the Unity physics system, the engine offers you a WheelCollider which handles wheel physics for you. Usual practice is that the wheel colliders ...
Philipp's user avatar
  • 120k
4 votes

Unity Random.Range not repeat same position

In general, if you do not want randoms throwing the same value twice, you implement a Shuffle Bag. Here's the idea: Generate every possible outcome and store them in a list. Remove from list ...
eclmist's user avatar
  • 1,153
4 votes
Accepted

How do I use coroutines to animate properly?

Calling yield break breaks the coroutine and the while loop in it won't start over again. The while loop goes through only once after waiting for 0.3 seconds. Use ...
Lasse's user avatar
  • 3,241
4 votes
Accepted

Unity RectTransformUtility.ScreenPointToLocalPointInRectangle

Preface This question starts with a small geometry problem. You have two different planes which may or may not be parallel. 1) Your screen space. This is the actual screen coordinates your computer ...
DrewAtWork's user avatar
4 votes
Accepted

is GameObject.Find() a bad idea even for one frame?

The GameObject.Find() function sure is heavy, but it doesn't mean your game will run slow if you use it even once. The idea is that it's better to get reference of ...
Tom Tsagkatos's user avatar
4 votes
Accepted

unity job system for 2d or more dimmension arrays?

Just flatten the 2d array into a 1d array by concatenating the rows. So a 2d array like this: 11111 22222 33333 becomes a 1d array like this: ...
Philipp's user avatar
  • 120k
3 votes
Accepted

A python script controlling a Unity game

Ok so first follow this tutorial. Then i wrote some code to try and test it out. C# code. I used the editor example from the tutorial but you can make it run during runtime or what ever: ...
Uri Popov's user avatar
  • 3,027
3 votes

How to Display hints to user when he is inactive for more than 5 sec in unity?

Whenever an action counting as active interaction (tap/successful match) happens, capture current time to a variable in the hint showing script. In Update() method ...
wondra's user avatar
  • 4,930
3 votes

How to make the wheels rotate depending on the speed of the vehicle

The idea is that you need to have the outer part of the wheel go on the ground at the same speed that the one of the vehicle. Assuming you have these values beforehand: ...
Vaillancourt's user avatar
  • 16.3k
3 votes
Accepted

timeScale=0 doesnt stop all prefabs in unity

With the exception of FixedUpdate, which isn't called with timeScale = 0, all other Update methods will get called, and have ...
General Waters's user avatar
3 votes
Accepted

C# Script file is not showing in Onclick Event in Unity 5.0.4f1?

You need to add the LevelLoader script to the LevelLoader object in the hierarchy panel. Then drag the entire LevelLoader object (not script) from the hierarchy ...
House's user avatar
  • 73.2k
3 votes

Unity bowling pins detection

Here's an example similar to how I detected domino tipping in Last One Standing. ...
DMGregory's user avatar
  • 135k
2 votes

How to compress Unity apk output?

You can use Tinypng to decrease you graphics size without visible graphics quality damage, Decreasing graphics size ultimatly leads to decrease in apk size. Make spritessheets either using Texture ...
Faisal Imran's user avatar
2 votes
Accepted

Why do I have to do minus-equals for the x-coordinate but plus-equals for the y-coordinate?

It has to do with the way the coordinates systems are set. In particular, what it means to increment the Y coordinate for the mouse? an on the screen?. I'm not sure which convention Unity follows, but ...
Gato's user avatar
  • 301
2 votes

What is wrong with my Chest script?

Is the script attached to the game object of one of the two chests CurrentChest and OpenChest? Then keep in mind that ...
Philipp's user avatar
  • 120k
2 votes

How to Display hints to user when he is inactive for more than 5 sec in unity?

Adding to wondra's solution, you can use OnMouseDown() in Unity to detect both mouse and tap events. So if you were to use: ...
DisturbedNeo's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible