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.

learn more… | top users | synonyms (2)

0
votes
6answers
481 views

How to stop jumping again when character is in air (double jump)?

I'm using touch inputs in my game to control the character. I would like to know how to disable my character from jumping again in the air. if (FingerTouchy.phase == TouchPhase.Ended) ...
0
votes
1answer
41 views

Very less vertical transformation

Im using pretty basic code here charcter.transform.Translate(Vector2.up * speed * Time.deltaTime); Im using rigidbody 2d and I'm creating a platformer. When i press the button the character ...
0
votes
1answer
73 views

Handle two different touch gestures at same time without overlapping

I'm trying to create a Character touch controls for 2d platform. In my script Im using one horizontal swipe and hold touch gesture and one vertical swipe gesture without hold.Both are different ...
0
votes
1answer
54 views

Invoking a common method after a button press

I want to implement a common method that handles several numeric values and performs and action based on those values. So I have buttons with specific methods to change this values without affecting ...
1
vote
2answers
144 views

Optimization of Cube-based World

I'm currently working on taking an idea I've been toying with in C++ and bringing it into Unity, but I'm struggling to figure out how to make it performant and how to do things the "Unity way". My ...
12
votes
3answers
1k 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?
0
votes
0answers
32 views

Sprite animated position outside unity

our artist chose to animate the position outside unity because he want the precision of how the animations should look like what this means is when the monsters is jumping he literally moved the art ...
1
vote
2answers
138 views

Unity setting rectTransform on an UI Image with a Vector3, do I need to convert coords?

I am trying to build a menu with a cursor. I created the menu and that in the unity UICamera on the canvas. It looks great. I want the cursor to move so what I did was move the cursor by hand and ...
-16
votes
1answer
423 views

How can I “squeeze” a game object when it is pressed between two others?

I am trying to "squeeze" a game object when it's pressed between two other objects (e.g., "squeezer 1" and "squeezer 2," below) that continue to move towards eachother. I wish to reduce width of the ...
0
votes
1answer
59 views

Trouble GamePad input on iOS but works perfect on Android

I am having trouble getting input from on iOS devices (iPhone 6 Plus and iPad). Here is my code, if (Input.GetKey (KeyCode.JoystickButton14))// A { chr_show = "A"; } if (Input....
7
votes
1answer
1k 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 ...
0
votes
2answers
101 views

How to make my Object Zig Zag

I have an object in 3D space with a certain height (y) component that I wish to remain constant. The object is a rigidbody, kinematic, affected by gravity and a trigger. So I tried this method ...
1
vote
2answers
157 views

What is the most efficient technique for range detection?

I have a bunch of patrolling enemies that fire projectiles when the player is in projectile range - a specific radius. Which method is the most efficient and elegant? overlapSphere sphereCast ...
6
votes
1answer
269 views

How do I properly light characters in a Unity scene?

I made a game prototype and want to improve some of rendering the visuals through light baking (which I'm new to). While I was mostly able to do this in my environiments, I'm having issues doing this ...
-3
votes
2answers
270 views

Random AI Movement

So I'm creating a zombie game where the zombies are passive and just walk randomly all over the area when player is not near. My question is: how would I make zombies move randomly? I code in C#. ...
3
votes
1answer
100 views

Distinguish touch gestures for distinct horizontal and vertical commands

In my script below I'm using horizontal and vertical swipe gesture to move the character but both gestures are called on a single touch. void Update () { HorizontalSwipe(); VerticalSwipe(); } ...
0
votes
0answers
40 views

How to create custom editor script only for one field of an object and leave the rest default in Unity?

I have a script attached to a game object. The script has many public fields and I'm satisfied with how Unity displays most of the fields for editing in the Editor. Except for a few. I'd like to write ...
0
votes
1answer
139 views

Why am I getting this “tag not defined” error?

In the log, it says UnityException: Tag: car is not defined. at PlayerController.OnTriggerEnter (UnityEngine.Collider other) [0x00000] in <filename unknown>:0 I'm checking against the tag ...
-1
votes
1answer
60 views

Combining Pause and Start Menu

I got my pause menu working by using this code: using UnityEngine; using System.Collections; public class PauseMenu : MonoBehaviour { public GameObject pauseUI; private bool paused = false; void ...
0
votes
1answer
58 views

Swipe and hold character movement not working

Heres my PlayerControl script void Update () { foreach (Touch FingerTouch in Input.touches) { if(FingerTouch.phase == TouchPhase.Began) { FingerInitialPosition=...
0
votes
1answer
84 views

Basic Moving/Anim Script [Unity CSharp]

So, I got this to do the anims for my sprite in Unity 2d... using UnityEngine; using System.Collections; public class Move : MonoBehaviour { public float Speed = 2; Animator anim; // Use this for ...
0
votes
1answer
70 views

Keeping camera at player's back

I'm developing a 3D game similar to the Roller Ball game from Unity's tutorials mixed with a runner type game like Subway Surfers. The game uses the arrow keys for control. When the player hits the ...
4
votes
1answer
234 views

How do I expose a field with a generic class to the Inspector?

I have some utilities implemented as generic classes. I would like to have fields of these types exposed to the inspector but they appear to not display. This test code: [Serializable] public class ...
-3
votes
1answer
49 views

How/where can i learn everything unity2d [closed]

I just learnt unity basics and would like to learn everything else related to 2d development beginner to advanced in less time. Because i dont want to stick to game business/development for a long ...
0
votes
2answers
85 views

Trying to use yield to wait for a few seconds to avoid the sounds from Interfering with each other

Ok so when my player hits a wall (Enemy tag). My player is destroyed after a certain amount of time. During this time, I disabled the mesh renderer on impact so it "appears" as if the player is ...
3
votes
1answer
150 views

Why do my .wav sound effects delay before playing the first time on iOS?

First off, I'm using Unity 5.2.3. I have a bunch of .wav sounds that I play like this: Debug.Log(m_audioAssets.m_soundBanks[(int)m_currentSoundBank].m_multiplier[data].loadState); ...
0
votes
1answer
105 views

Distance based item interaction

I'm having an odd issue in my implementation of distance based object interaction in Unity. Basically it's a simple "Press [key] to [search/pickup/open/etc]" function which requires the player to be ...
0
votes
0answers
21 views

How to use camera in unity engine?

i'm new to game development, and i want to learn more about camera programming in unity. I am good in C#, so scripting is not my weak point. I dont really know how to start. Could you please refer ...
2
votes
1answer
56 views

How do I expose a field of an abstract type to the Inspector?

I have a class hierarchy with an abstract parent class. I would like to have a field of this type exposed to the inspector but it appears to not display. This test code: [Serializable] public ...
2
votes
0answers
82 views

How to detect collisions with a material in Unity 5?

I've got a simple car game with 3 different surfaces: grass, tar and sand. I have a basic skid smoke system, but I want the color of the skid smoke to change depending on the surface, for example on ...
1
vote
1answer
155 views

Is it possible to interpolate different sprites? [duplicate]

I can interpolate different animations based on position, rotation, and scale. I want to do the same for different sprites, automatically. For example, lets say I have a soda can being crushed. I ...
1
vote
1answer
119 views

How do I make a 2D sprite flash green when tapped?

I have a sprite that is based on an image of a gray circle. When the user touches the sprite, I want the sprite to flash green, as in I want the circle to appear to turn green for 0.2 seconds. I tried ...
0
votes
1answer
79 views

How to Implement a Timer for my Prefab for Roll-a-Ball Game (C# in Unity)

I am trying to create a public float timer that senses when the particular prefab has not been there for a certain amount of time. Then, it will replace that particular object. The goal is to ...
0
votes
0answers
66 views

Spatial based Augmented Reality with Unity

I want to create an augmented reality application that is based on a spatial / location based overlays. Similarly to Infraworks by Autodesk or Flight Radar 24, the user will hold the device vertically ...
0
votes
0answers
110 views

Facebook Unity SDK Share Callback Returns Success When User Cancels

Here is the code piece i used to debug: public void Share (FacebookPost post) { FacebookDelegate<IShareResult> innerCallback = (result) => { foreach (var item in result....
0
votes
1answer
65 views

how to transform the position of an object

I am trying to transform the position of an object. I have totally 3 Objects and 2 triggers, objects are 1. Left_Wall, 2. Right_Wall, 3. Obstacles. 1st trigger for transform the position of an objects ...
-1
votes
1answer
64 views

This if statement doesn't end once triggered by touch

I have an if statement that successfully recognizes a touch, but continues executing after the touch has ended. void Update() { float currentstep = speed * Time.deltaTime; Vector3 ...
2
votes
2answers
165 views

About tiles in games

I'm trying to learn how to develop games in Unity and my base is tiled games, I would like to know if a simple tile is an image (sprite in 2D) or a game object in 3D. Since I'm trying to do some kind ...
0
votes
0answers
54 views

cannot sync for connected player after spawning meteorite ( photon PUN and ufps)

did anyone run into such bug? It happens when second player connects to a game, and that's what he sees. But players who connected earlier see everything well: meteors which I spawn by master-client ...
2
votes
1answer
115 views

Why is Unity UI Image color not being animated? [closed]

Animation is changing the color of an UI Image but the color only changes only in the inspector but not Game/Scene view. In this video I demonstrate the problem clearly.
0
votes
1answer
236 views

Unity not opening

When I start my Unity it opens up the menu where I can select a project, but when I pick a project nothing happens. The process is still running in my windows but nothing shows up. Here is my log file:...
0
votes
1answer
137 views

Why is FindObjectOfType(MyType) not finding anything?

Why would I get the following log? Start OpponentMotionReceiver motion receiver not found true public class ScoreAnimation : MonoBehaviour { private OpponentMotionReceiver ...
0
votes
0answers
48 views

Is it possible to use a Unity 3d Model with libGDX?

Can I use a 3d model like https://www.assetstore.unity3d.com/en/#!/content/36951 in a libGDX 3d game?
2
votes
1answer
92 views

Transitioning through menus in Unity: what is the best option performance-wise? [closed]

I'm making a menu manager and I'm not sure what should I do to make a transition from one menu to the other. What is better to be used performance wise? Here is the step in my mind. Simple enable or ...
2
votes
2answers
320 views

Play soundcloud in Unity 3d

I'm trying to make a game with cool soundtracks from a bunch of artists. I've made a few playlists in Soundcloud (soundcloud.com) and am trying to get those to play inside of Unity 3d. Is it possible ...
3
votes
1answer
351 views

With Cardboard, reorient player to direction of gaze

This may be a little hard to follow. I have a script set up in Unity, and attached to my CardboardMain object that allows a user to press the button on a Cardboard headset to move in the direction of ...
2
votes
1answer
174 views

Unity - Autoscroll when selecting buttons out of viewport

I have a ScrollView element, that contains many buttons. I want that when I select buttons (via arrow keys), the panel scrolls so that the selected button is contained within the viewport. How could ...
11
votes
3answers
812 views

Unity - How to move a ship realistically to a point in a 2D top-down game

i'm trying to move a sailing ship to the point where i clicked with the mouse. this movement should be realistic (oar at the back where the ship moves around) so if the mouse click is left and in ...
1
vote
3answers
140 views

Unity: How to manage a large amount of prefab variations?

The project that I'm working on demands the ability for game designers to be very flexible when balancing, customizing items, etc. The most difficult requirement to meet at the moment is that they ...
2
votes
3answers
93 views

How can I avoid instantiating multiple instances of a RigidBody?

I could use a little help. I've a state machine for an NPC that does a melee attack. The problem I'm running into is that the current code instantiates multiple instances when I only need one per ...