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 (1)

-2
votes
1answer
37 views

Joystick control for camera only works when button pressed

I'm trying to use a controller that has a joystick. I'd like to move the camera when the player moves the joystick. The joystick also has a button. So far I'm only seeing the camera move when the ...
0
votes
0answers
21 views

Creating a ray with angle movement restrictions

In Unity is it possible to create a ray which has movement restrictions. As in creating a ray which is fixed to one point. When this point is moved around. The line is also moved around. But when the ...
1
vote
1answer
52 views

Unity Raycast shoots right through some objects

I made a melee combat system for my game. The code looks like this: var hit:RaycastHit; if(Physics.Raycast(transform.position,transform.forward,hit)) { if(hit.distance<=2.0) { ...
0
votes
1answer
51 views

(Unity)How to make the BGM not stop between scenes

I want my BGM to keep playing on loop, but whenever I transition into another scene, the loop starts over. Is there any way to have the scene record the last point of the music it plays, and in the ...
0
votes
1answer
24 views

Destroy a single list member

im trying to destroy a single game object using the following script but it destroys all of them , not the ones I want. I want to destroy the ones that the transform that holds this script collides ...
0
votes
1answer
51 views

Finding a moving target in a maze

I'm making a game that is a bit of a mix of snake and pacman. Basically, two players go through the maze and each time they pick up a piece of candy, a cube is added to their tail. If one player ...
0
votes
2answers
102 views

How does Vector3.Angle compute the resulting angle?

I don't understand the concept of Vector3.Angle in Unity. Can someone please explain in detail how it computes the angle? From which two points is the angle measured? It would also be really awesome ...
0
votes
1answer
84 views

Jump Issue(Unity3D)

This is my first character control script. Where a cube is my player and the objective the i want to achieve with my script are 1.the cube moves in horizontal axis till the button is pressed once ...
0
votes
0answers
24 views

How can I keep vertex order the same on every Instantiate()?

While trying to resolve another question, I have discovered that if I Instantiate() from a prefab, the order of the mesh vertices (and therefore triangles) is inconsistent between instances. This is ...
0
votes
1answer
54 views

Find index of GameObject in array of GameObjects

In my script, i have declared an array of GameObjects like this: public GameObject[] go;ld object name. `String temp;` Also, i have a temporary variable to ho Then, i assigned objects to elements ...
3
votes
1answer
310 views

How can I separate component functionality from networking logic?

Is it possible to make network independent components that allow networking details to be specified externally? For example, if I have a "Follow" script that follows a game object, it would need to ...
0
votes
0answers
52 views

C# Unity Camera smoothing [closed]

I am using this code to smooth cameras' movement with the moving object but when the object reaches max velocity it seems to lag (not fps problem). using UnityEngine; using System.Collections; ...
1
vote
1answer
27 views

How to transform Unity terrain coordinates

My map creator created some terrain in Unity, but all my scripts are based on the X-Y axis. Is there an easy and smart way to transform them into Z-Y, or do I have to change all the vector variables ...
0
votes
2answers
65 views

How can I make animations “snap” between transitions in Unity?

I have an animator with a few animations in it. These are very basic animations, just changing a transform to slide a sprite around in a cutscene. The issue that I'm running into is that when I ...
2
votes
1answer
86 views

How do I change a Unity 4.6 Sprite's textureRect at runtime?

I'm using Unity 4.6, and I've made a sprite like this: AtlasFrameData frame = _testAtlas.GetFrameByIndex(0); Rect spriteRect = new Rect(frame.Position.x, frame.Position.y, frame.FrameSize.x, ...
2
votes
1answer
265 views

Change unity physics engine speed

Is there a simple way to change the speed* of unity's physics engine like in the game SuperHot? Any script language is ok but javascript is preferred. *I am not sure if speed is the correct term.
0
votes
1answer
48 views

Environment collision in a pseudo-3d 2d space

The game is a 2D brawler with depth movement in the vein of Golden Axe, Final Fight, Castle Crashers etc. Characters and environment are all 2d sprites as well. I've had no real issue setting up ...
0
votes
1answer
27 views

Unable to instantiate objects Straight in unity

I am creating a match card game in unity and I want to place cards in straight direction that is one below another and so on... But with my formula It's showing cards one after another.Please tell me ...
3
votes
1answer
75 views

How can I consistently identify location on a mesh from a raycast hit?

I am using RaycastHit.triangleIndex to identify a location on a mesh (very low poly). However, I have discovered that a given triangle on the mesh does not have the same triangleIndex value from one ...
0
votes
0answers
13 views

Unity StartApp Ad Sdk dims the screen down when showed

I'm making an android game Which Never Sleeps and it don't. But When Using Startapp ad sdk It seems that it pauses the game and the mobile sleeps when the ad is shown. As if the sdk handles it from ...
1
vote
1answer
136 views

Trouble With Quaternions and orbital camera:

UPDATED: I have been trying to implement a Orbital Camera of sorts in a engine I am currently doing in Unity3D, the issue being I can't seem to do the correct rotation no matter what. This is what it ...
2
votes
1answer
66 views

When two RPC methods have the same name, which is called?

I have a situation where I would want two of the same components( in a hierarchy ), to be on a GameObject. If this component has an RPC method, it obviously cannot change name per instance of the ...
0
votes
0answers
15 views

Stream Unity video and audio straight to a webcam

I want to render my unity game straight to a web cam feed. I'd like it to show up as a webcam so I can use it as an input source when I'm video chatting. I've looked into DirectShow and I think I can ...
0
votes
1answer
51 views

How can I disable an NGUI button when I pause my game?

There is an NGUI button in my game, which when pressed increases the player's power. When I press the escape key, my game pauses completely. But the button still functions normally. Here's how I ...
-2
votes
1answer
48 views

Split up a string and add each as an item in an array [closed]

I have an input string and input the following "2, 4, 5, 7, 10" (for example). How can I split it as an object(item) for a list array? so it would be in each item "2", "4", "5", "7", "10"
2
votes
1answer
64 views

Mock Collision Object in Unity

Problem: I'm trying to set up some tests with mock collision objects, but i cannot construct collisions with custom objects. What I'm trying to do: Collision2D col = new Collision2D(); ...
2
votes
1answer
64 views

Unity messes up the fileIDs

I'm working in a team of three people on a 2D game, and Unity recently has been messing up the fileID on many sprites: - m_Sprite: {fileID: 21300000, guid: 6186fa4d068aae8418d9520f658d1ee6, type: 3} ...
0
votes
1answer
99 views

Where should I put code if I want it to run automatically?

I'm new to programming and I found an animation script that has code that is called in the OnMouseDown event, when the user clicks the object. I'd like the code to run automatically, instead of ...
0
votes
0answers
24 views

Bones are incorrectly rotated in FBX after Unity import

I am importing an FBX into Unity. The problem I have is that it looks like the bones are rotated by 180 degrees. When I try to rotate the them the whole model is also rotating. How can I fix this? ...
1
vote
1answer
28 views

How to constrain axis-angle rotation?

I have a problem where I'm performing an axis-angle rotation and am trying to constrain my rotations. Specifically I have a skeleton (model/mesh with rig, transforms are hierarchy parented to pelvis ...
0
votes
1answer
71 views

How to execute code every x seconds in unity?

So I have a flashlight battery script I created and I need to know how do you make the battery variable go down every few seconds(whatever time you set.) I tried InvokeRepeating but it was an absolute ...
0
votes
0answers
14 views

How do I view currently downloading assets in Unity?

So I'm completely new to Unity, and in order to do some tutorials on their website I need project assets from their Asset Store. So, I go and download one, and I had no idea to see it was downloading ...
1
vote
0answers
69 views

Getting child collider when collision occurs in compound object in unity3d?

I have a compound object. The parent of the compound object hierarchy has a script that is listening to the OnTrigerXXX callbacks of the children. When this compound object collides with other objects ...
0
votes
1answer
62 views

Assigning multiple game objects to a single sprite (Unity)

I've been making a pokemon game clone on my own with Unity, as I'm a beginner and just trying to learn. Up until now I've been splicing the town pictures and manually putting them together, but this ...
3
votes
3answers
180 views

How to create a two-way teleport system?

I'm trying to create a two-way teleport system in which players can move into a teleport gameobject, and is then teleported to another linked teleport gameobject. How I was planning to have it work ...
0
votes
1answer
60 views

Why does Unity save textures in bitmap format for APKs and IPAs?

Why does Unity save graphic resources in Android apks and iOS ipas in a bitmap format(width*height*bpp)? I want to save my resources in a small apk, but instead of 1mb for an image Unity stores 11mb ...
7
votes
1answer
352 views

How do I render my 3D game in ASCII art?

I'm trying to create an easter egg for a 3D game in Unity3D. I've the idea to pass my game momentarily in ASCII art. My first idea is to create a shaders to do that, but i'm not sure if it's the ...
0
votes
0answers
61 views

Rotate object against Gyroscope in Unity

I would like to rotate a simple object against the z-rotation of the gyroscope of a smartphone, so that the object will always "look" to the physical floor where the user is standing. After that, I ...
0
votes
0answers
81 views

Change graphics in-game (without needing to restart)Unity

Hey I am new to scripting and I am not so sure if this is possible to do in Unity. Currently I have it for example; public void AntiAliasing(GameObject Description){ sliderValue = ...
3
votes
1answer
84 views

How to create laser redirection?

Think portal 2, where a laser can go through a cube, and depending on the rotation of that cube, it will redirect it. Examples: Here is my barely functioning code. It works for one cube, I'm able ...
0
votes
2answers
145 views

Can the GUI be used to create game objects?

I want to be able to position 10 various game objects (sprites) within the area of the screen which will be dynamically sized accordingly to the screen size of the device. The area in which I want to ...
3
votes
1answer
62 views

Parallax effect for layers in Unity2D

I have a simple game scene where i have put a number of images. I combined these images into layers (SortinLayer, to be specific). So now I have 3 layers. I have read a few tutorials, but in them was ...
1
vote
0answers
45 views

Manual response when 2 shapes made of rectangular volumes collide

I have 2 compound objects made of rectangular blocks. One of them (the one that is moving) has a script that listens to OnTrigger callbacks. What I need is to position the moving compound object on ...
0
votes
1answer
29 views

Change sprite at touch input: “scroll through characters”

if(Input.GetKey("y")){ gameObject.GetComponent<SpriteRenderer>().sprite = Characters[0]; } if(Input.GetKey("u")){ ...
0
votes
1answer
67 views

Where do I store project data in Unity?

In Unity the PhysicsManager has project data. It exists across scenes but its data is unique to each project. If it make my own CustomManager, where/how to I store its data so that it's associated ...
1
vote
1answer
77 views

What causes sprite tearing / corruption in unity PC stand alone running on Windows XP?

The image below is representative of my client's experience running the released version of an app I created for him on his Windows XP Machine. I built it using Unity 4.5. The messed up buttons ...
0
votes
1answer
39 views

How to invisible first window on click unity3d

I have a window called "red window" on scene1. When i click on the hello world button it should displays another window called green window and the first window should invisible. How it possible. ...
2
votes
1answer
119 views

Modular enemy behaviour in a shmup - Delegates unsuitable?

I'm creating a shmup type game and trying to implement the enemy wave system, which includes the associated enemy behaviours like their movement and bullet patterns. I've tried to separate the ...
2
votes
1answer
54 views

Unity Android Orientation Bug in Auto Rotate

I am currently looking for a workaround, or fix, for a Unity bug. I want to be able to auto-rotate my game, while respecting the Android system settings. Currently, if you set your Unity Orientation ...
1
vote
3answers
115 views

How do I define a required component on a Unity game object?

I have a script that expected the game object to have a Terrain component. Is there an attribute I can add (or some other way) which will prevent a designer from adding my ...