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.

Filter by
Sorted by
Tagged with
2
votes
3answers
3k views

How can I set up Unity so that 2d images are displayed in their original resolution?

I took images from my iOS game that I am developing in SpriteKit and put them in a Unity Android 1136x640 screen, which are the same dimensions for the iOS game but the images are a lot smaller. How ...
1
vote
2answers
2k views

Pool game ball path line

I'm using Unity C#. How would I create the effect in my pool game, a line showing the direction of the second (not white) ball after collision. Example: I need to make the line coming from the ball ...
1
vote
1answer
3k views

Unity C# - Change color, or material of specific line segments on Line Renderer

We're making a game that plays with a LineRenderer, and we want to give it a different visual feedback relative to the side of the screen that it's on. We want to change the feedback of the specific ...
1
vote
1answer
6k views

How can I import a Google Sketchup model with textures?

I'm using Unity 4 and trying to import a SketchUp Model into Unity and other Engines - but I can't get it to import correctly. Can anyone help me out?
1
vote
3answers
21k views

Unity 3d auto-move player forward script

Trying to write a basic script to attach to the player on Unity 3D, I want them to move forward automatically. I'm guessing that will be part of the Update function and using transform, but that's ...
1
vote
4answers
27k views

How can I do something only after an animation has finished?

I'm making this 2D platform based game. Basically what I want is when the player walks into spikes (which have a "deadly" tag") it displays the animation that has the parameter of animate with the ...
1
vote
1answer
4k views

Unity - blur on one camera effects the other as well

I'm trying to fake a DOF effect for Sprites by using 2 cameras, one for the sharp objects, one for the blurred ones. I have set up the layers like Blur and Sharp accordingly. So I have these 2 ...
1
vote
2answers
4k views

In Unity3D, how do I create an efficient scratch card effect?

I want to create a scratch-card-like effect in new Unity UI's new Image tag. I know it's possible with setPixels, but that's prohibitively expensive on mobile ...
1
vote
2answers
440 views

Fade in rendering mode doesn't work as intended

The picture shows an object made out of one model. The object works as intended when rendering with opaque rendering mode, but I want the object to fade in/out during animation. The glitch seems to ...
0
votes
1answer
1k views

How does unity size graphics?

I'm working on a 2D game. It has tiles. each tile is 50x50 px. I attached script to camera which sets the camera size to screenHeight/2/PixelsPerUnit. Now in the player, as an example i selected ...
0
votes
2answers
726 views

Unity : how to Rotate GameObject back to Indentity position?

Hello i m trying to rotate my object smoothly over MouseButtonDown and rotate to identity position on MouseButtonUp and this code rotate my GameObject smoothly but it won't come back to identity ...
0
votes
2answers
3k views

Generate static 2D Tilemap from array

How do I generate a 2D tile map from an array like in this tutorial for XNA ? I basicly want to generate a static map based on my tile prefabs.
0
votes
1answer
129 views

How to construct a propeller clock in Unity?

I am considering the possibility of using Unity to construct a propeller clock https://www.youtube.com/watch?v=-6JnAxTXApw . It's an array of LEDs on a PCB board connected to motor that spins at a ...
0
votes
1answer
86 views

Calculate mesh normals with added noise

I'm creating a procedurally generated planet object in Unity. I start with a cube which is created from 6 meshes (6 sides) and normalize the vertices to get a standard sphere. The problem is that ...
-18
votes
1answer
2k 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 ...
9
votes
0answers
140 views

Why Can't I duck reverb on the mix bus in Unity?

i'm surprised there is so little documentation on this issue. But i'm trying to duck the audio on all the mix buses in Unity so that you can clearly hear the VO of the game. Now it works great except ...
7
votes
1answer
165 views

How to create an illustrator/photoshop-like pentool for creating bezier curves in Unity

I found a very useful bezier curve creation code here, which I am using. I need to create complex segmented bezier curves so I want update the code to create illustrator/photoshop-like pen tool bezier ...
6
votes
4answers
23k views

Making holes in 3D objects (Unity)

How can I make a hole in an object with Unity 3D? I've something like this object and I want to make a hole in it.
5
votes
2answers
380 views

A coroutine to rotate one point around another by a given angle without referring to game object

I need to rotate a point around another point (in 2D) by a given angle over a given duration, independent of game object (meaning that I've manually created the points and they're not positions from a ...
5
votes
1answer
202 views

How can I look up an object given only the name of its type?

This question came from a fellow developer on Twitter, and I figured StackExchange would be a better format for explaining & sharing the answer. To paraphrase the question: I'm setting up an in-...
4
votes
2answers
3k views

In Unity, does a reference delegate clear out when its parent GameObject is destroyed?

If I have a GameObject with a component like some: ...
4
votes
1answer
740 views

Unable to use Maya animation with scripts when imported to Unity

I am testing to import Maya animation over to Unity. I set up a simple cylinder with 2 bones and an IK handle. Made a simple animation where the cylinder bends and goes back to straight position over ...
4
votes
2answers
972 views

Should I use Async & Await, instead of Coroutines, in Unity?

Should I use Async & Await in Unity? Or should I keep using Coroutines? If I should use Async & Await, how can I do so in a manner comparable to Coroutines?
3
votes
4answers
4k views

Smooth Camera Follow

I am using a fixed static background. I have a gameobject(Current ref. image) which is moving with the help of waypoints. I have made camera to follow the Current. The camera is stuttering while ...
3
votes
3answers
9k views

Unity doesn't change particle color when render is set to mesh?

I've got a particle system with Render Mode set to Mesh. Then I applied a material to it, which is just white with the default shader. Now I can't change the start color nor the color over lifetime ...
3
votes
4answers
8k views

Unity ScreenToWorldPoint always giving same coordinates with mouse position

I have a question about Unity's ScreenToWorldPoint. Whenever I use ScreenToWorldPoint(Input.mousePosition) and display the output in console this always gives me the same coordinates. MyCode: ...
3
votes
2answers
2k views

Counting triangles and vertices in Unity's cube

I want to understand logic behind drawing triangles of primitives in Unity. When we spawn simple cube, variable mesh.vertexCount gives us value 24. Also when we list all vertices positions (from mesh....
3
votes
2answers
814 views

How to make an event happen only at the first start of the game?

I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears ...
2
votes
1answer
8k views

Why does this transparent shader cause objects' z-sorting to be backwards?

I am making a Klondike Solitaire game, with the intent of later expanding it to encompass other solitaire games and allow deck customization. As part of this, the playing card meshes I am creating ...
2
votes
1answer
3k views

Cave lighting in Unity

I have a cave that is inside a mountain (one mesh) that I created in Blender. I would like to make the cave quite dark inside so that either the player can light it up, or it is lit up with things ...
2
votes
1answer
1k 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. ...
2
votes
2answers
5k views

Make camera follow and rotate with player without childing it

I want to have a camera, that follow the player, without childing it to the player object. So far I have this one line, that follows the player, but does not rotate with it (meaning the camera should ...
2
votes
1answer
8k views

How to use Resources.Load with an AudioClip in Unity?

I'm trying to load an audio clip that's in my assets directory and play it. Here is my C# script: ...
2
votes
2answers
162 views

Help with character turning?

I'm simply trying to make my character turn in his place, whether he's standing still or moving, currently, he isn't turning what-so-ever. Here is the code that I currently have for turning: I AM NO ...
2
votes
2answers
1k views

Structuring game narrative. Handling NPC, Quest, General Dialogue. Is Json/XML the right way to go? Or any other solutions?

Hello guys I'm try to make some games that have more to it than just simple high score scrolling shooters etc. I'm trying to design my own systm of handling narrative. I want to be able to place NPC'...
1
vote
1answer
632 views

Where to store in app purchase data?

I'm making a game using unity. In the game I've a purchasable product "remove ads". Where should I store user purchase data? If I use player prefs data will restore after a reset or uninstall.
1
vote
1answer
627 views

OverlapBox() dimensions are huge but are fine when tested in isolation

To be completely transparent, I more-or-less copied this question from the Unity forums since I did not get a reply. I'm creating this system where I'm placing level chunks together and I need to ...
1
vote
2answers
5k views

Move rigidbody using WASD keys but rotate it based on camera/mouse movement

I am very new to unity and my scripts are based on some scripts found on the web. I want to make a first person view so the camera is attached to my rigidbodys head. Then i want to move my rigidbody ...
1
vote
1answer
81 views

Should I use a database to store ~10 000 names in a sports game?

I'm working on a single player sports game for a year or so and this doubt came up: how should I treat/store big amounts of data, like player names. Let's take an arbitrary number as example: 10000 ...
1
vote
1answer
643 views

how to get if a rotation/position has been completed?

I've done an if / else with the final position / rotation plus they never complete, how can I check this? stays like this https://i.imgur.com/3cQ9AEk.gif ...
1
vote
1answer
98 views

How to move points of a multi-segmented bezier curve to one side

I am trying to move points from a multi-segmented bezier curve to one end of the curve using the following code which modified for my use from here. Only the last segment seems to give the desired ...
1
vote
1answer
3k views

Unity JSON parsing Array of Objects problem - error: JSON must represent an object type

I'm trying to use Json to hold game dialog in a text asset file. I've tried to make a barebones project to test this and it is failing with the Error Message: ArgumentException: JSON must represent an ...
1
vote
1answer
786 views

Using StartCoroutine() and WaitForSeconds()

I am trying to perform two operations. First I want to increase the size of a GameObject and then delay for 0.1s before returning it back to its original size. However, when I try using StartCoroutine(...
1
vote
1answer
208 views

How do I set up a bullet to fire towards the mouse pointer?

I am making an FPS, in Unity. I have a player with a gun, and I have a bullet prefab. I changed the mouse pointer to look like a crosshair, but I don't know how to place the bullet where the crosshair ...
1
vote
1answer
1k views

Unity3d select empty gameobjects in scene

I have a pathing system that I am creating in Unity. When you add nodes to denote the path, I create a empty GameObject and render it in OnGUI as a square. The problem that I have is clicking on the ...
1
vote
1answer
860 views

Unity: cg fragment shader processing array of points

I need to write a fragment shader which would somehow be aware of N points that are in the scene and darken pixels based on their world coord distance to the points. I'm looking for a method that ...
1
vote
1answer
91 views

Method causes OutOfMemory error

If a GameObject in my game has a special ability it triggers it, but I want all the special GameObjects that this GameObject affects to also trigger their abilities, for example if a bomb hits some ...
1
vote
3answers
598 views

How to rotate within a fixed interval in Unity?

I have very recently started to learn Unity. I'm trying to write code that will make a character swing a flag. I want to use this object and rotate the arm up and down. So I need to make it rotate up ...
1
vote
1answer
3k views

How do I disable fog on specific camera/s

I'm building an FPS with fog and I want to include a dynamic minimap, showing the locations of player and enemies in real time. This is utilized by a second camera which is orthographic and looks at ...
0
votes
1answer
266 views

What is the geometrical interpretation of Input.GetAxis(“Mouse X”)?

According to the documentation, Input.GetAxis("Mouse X") produces a range of values from -1 to ...

1 2 3
4
5
17