Skip to main content
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
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
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
  • 122k
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

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
  • 136k
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
  • 27.5k
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

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,143
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

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
  • 122k
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.3k
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
  • 136k
2 votes

For each array within array using UnityScript

Generally in javascript, you use for...in for objects. For arrays, you can use forEach. Like ...
jack's user avatar
  • 121
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 I have to press the button twice to deactivate the GameObject for the first time?

At the Start() you're setting the variable settings_menu to false, then you're checking whether that variable is false or not. ...
John Hamilton's user avatar
2 votes

Update and FixedUpdate together

They are actually all running at the same time, your scripts just do stuff in those functions. Update is called once per frame and FixedUpdate is called once every "physics update" (which is once ...
John Hamilton's user avatar
2 votes
Accepted

Optimizing data structure for my text adventure?

I strongly recommend making your own file format that optimizes viewing and editing of the text parts. Get rid of redundancy to reduce errors while editing. You'll also want to get rid of numeric ...
Peter's user avatar
  • 9,955
2 votes

How to implement jump in NavMesh?

Why it is not working As you said, the function is called as soon as you hit Space. That's why it doesn't work because isKinematic is then instantly reset to ...
Shashimee's user avatar
  • 1,270
2 votes

How to always land a square box in 90 degree

If you have a fixed speed: If you know the starting speed (the speed you launch the box at) and the gravity, then the time the square spends in the air is v / g, ...
Bálint's user avatar
  • 15k
2 votes

How can I make car respawn with temporary invulnerability i.e. no collisions?

Thanks to DMGregory!! I Change the layer, I make that layer 10 and 9 not collision, but if the 10 collides with itself: ...
NorbyAriel's user avatar
2 votes
Accepted

How can I get the vector3's names to gameobject name?

While there is a way to get the name of a variable in C# (I do not recommend this), you'd still have to perform that stringification before calling ...
Draco18s no longer trusts SE's user avatar
2 votes

How can I get the vector3's names to gameobject name?

As Draco18s mentioned, with your current code you'll need to get the string before calling SpawnLineGenerator(). If you're using C# 6, the ...
Freddy's user avatar
  • 21
2 votes
Accepted

How can I make the objects to move at the same speed as the lines?

I think what you probably want to do is move your object first, then move the line to meet it: ...
DMGregory's user avatar
  • 136k
2 votes
Accepted

Unity Player Movement Problem

The problem is in this line: transform.position = move * speed * time.deltatime; If the value of move*speed*Time.DeltaTime is ...
Leo's user avatar
  • 1,585
2 votes

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

When you use Find only once when the scene loads, then performance is unlikely to be an issue. You would have to do that for quite a lot of objects to get a notable increase in scene load time. But ...
Philipp's user avatar
  • 122k

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