The tag has no wiki summary.

learn more… | top users | synonyms

5
votes
4answers
3k views

Does Unity let you code in Java?

I am fairly new to Unity3D experience , but I have a very good knowledge of Java and Android development. I am really confused that if Java is at all needed for developing android applications? I read ...
4
votes
1answer
206 views

Prefab random rotation in editor

Is it possible to automacicaly random rotate pefab during placement in editor in unity 4.5.3? I can make it autorotate in game(at start) but I want it to be visible in editor and at fixed rotation ...
4
votes
1answer
279 views

Why do my velocity estimates have such a large margin of error

I am writing a script in unity that applies a force to the object to advance it a set distance in an environment without friction or drag, producing a cosine force curve. However, as the target ...
4
votes
0answers
68 views

How can I copy an asset folder programatically depending upon a constant?

I have a Unity project in which I have 200 games and some 350 scenes. Now I want to make separate builds for each game. All my assets are present in Assets/IgnoredAssets/ABC folder. To include these ...
3
votes
1answer
637 views

How to compress Unity apk output?

I made a game with Unity but the size of .apk file got so large, it is about 70mb... Is there some way that I can compress my apk file?
3
votes
1answer
313 views

curve objects in unity3d to wrap around an invisible cylinder?

Is there a way to transform objects in unity3d so that they can become curved? Imagine that I wanted to create a rectangle that wraps around an invisible cylinder, or that I wanted take a sprite image ...
2
votes
2answers
748 views

How do you reference one game object from another?

I am trying to reference a game object that was created in the editor and added to the scene (not created dynamically). How can I reference this object in a script added to another gameobject? For ...
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.
2
votes
2answers
779 views

How do I get mouse x / y of the world plane in Unity?

I am trying to make a tiled landscape. The terrain itself is not made from tiles but the world has a grid which I define. I would like to place boxes/rectangles which snap to this grid, at runtime, ...
2
votes
1answer
2k views

How to get all keys and values of the PlayerPrefs in Unity?

I'm storing player name and scores in the Unity PlayerPrefs. I'd like to list all the names and scores stored in PlayerPrefs and display a high score page: Is it possible to display all the keys ...
2
votes
1answer
452 views

Translating a terrains position using input in Unity 3D C#

I am trying to make a terrain in Unity move, but im having trouble. Here's the code i have. using UnityEngine; using System.Collections; public class NewScript : MonoBehaviour { Camera camera; ...
2
votes
2answers
174 views

How to be sure that a target goal in a match 3 game level will not be impossible?

This is clearly not a coding problem but the logical one. I am starting to learn how to make a match 3 game. but there is a question rising in my mind. when i will set goal to complete the level, how ...
2
votes
1answer
844 views

How do you set the target location for a navmesh using a GameObject?

I am trying to get a GameObject to navigate through a map and get to the exit. I have created a navmesh for the map and given the player GameObject a navmesh agent. The exit is marked with a empty ...
2
votes
2answers
137 views

Finding diagonal objects of an object in 3d space

Using Unity3d, I have a array which is having 8 GameObjects in grid and one object (which is already known) is in center like this where K is already known object. All objects are equidistant from ...
2
votes
2answers
2k views

Retrieve the original prefab from a game object

How would one proceed to retrieve the original prefab used for instantiating an object? In the editor these two functions work : Debug.Log(PrefabUtility.GetPrefabParent(gameObject)); ...
2
votes
2answers
1k views

android game development using unity 3d [closed]

I want to learn android game development. I dont have any programing knowledge. So should I learn JAVA and eclispe to develop games for android. Or should I learn Unity 3d. And is knowledge of java ...
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 ...
1
vote
4answers
1k views

Get GameObject to bounce of colliders [duplicate]

I am making a Atari Breakout game with unitys 2d tools and I need to get the ball to bounce of colliders in the scene. If you havent played the game before how it works is if the ball hits the wall at ...
1
vote
2answers
131 views

Why should I use getcomponent?

I have already referred the animator by using the statement, Animator anim; But,What is the use of getcomponent in awake() function.What happens without it.
1
vote
2answers
1k views

Unity3d how to show an image downloaded from HTTP

I am bit new to Unity3d. I am fine with any solution either of the scripts. Can we render an image in unity3d (which we have to download from HTTP path)? If yes then how or do you have any reference? ...
1
vote
1answer
317 views

What does Quaternion.Lookrotation do?

I have this code, if(Physics.Raycast(camRay,out floorHit,camRayLength,floorMask)) { Vector3 playerToMouse = floorHit.point-transform.position; playerToMouse.y=0f; Quaternion newRotation ...
1
vote
2answers
2k views

How do you make the first person object the main camera?

How can a first person object character be made to be the primary viewing camera in unityscript? Do I remove the main camera? or just turn one or the other on/off?
1
vote
1answer
341 views

How to circle an uneven object with Camera at a fixed distance?

Unity3d. I am trying to move an object with Camera around a fixed terrain (Mountain), while staying an set distance from its edge. I have the camera set to lookAt the mountain, and I want to circle ...
1
vote
2answers
1k views

How to change transform.position.x after a state is changed?

When I press attack button, player will change to Normal Attack state to perform Normal Attack animation and you will notice the player seem like step back a little bit as the width of sprite for ...
1
vote
1answer
115 views

touch.phase == TouchPhase.Canceled not worked

i m tired to handle and solve issues related to multitouch. i m use maximume 5 touch simultaneously but when two touches are down on two object and i moved my fingures then that both touches fired ...
1
vote
1answer
87 views

How to use sprite as font in Unity?

I've started working on my first game in Unity; It's very simple, there's a spinning block in the middle, and there are spinning blocks coming from all sides. When they hit the middle block, you lose ...
1
vote
1answer
161 views

Converting a GameObject method call from UnityScript to C#

Here is the UnityScript implementation of the method i use to generate a randomly tiled background, the problem i'm having relates to how to translate the call to the newTile method in c#, so far i've ...
1
vote
1answer
43 views

How should I pause a rotation when my character collides with a gameObject?

My character always moves forward and when he enters a turn(Trigger) this is what happens: if(other.CompareTag("TurnLeft")) { // Rotates the character in 90 degrees in 6 seconds. ...
1
vote
2answers
2k views

Retrieve variable from another class and send to another scene in Unity

Sorry for asking a noob question, but I have never used c# in Unity, only unityscript. Basically I have a public int score variable stored in Players Class. I need to retrieve it in the following ...
1
vote
1answer
428 views

No intellisense on my classes

I've been using Monodevelop's current version and Unity 4. I don't get intellisense on the classes I've created but I do have intellisense on classes that are in Unity's framework. Bug or its just as ...
1
vote
0answers
38 views

How to initialize once for all a static field of a custom editor in unity

I have a custom editor wich has a static field. Suppose you have a static field of type MyObject: public class myEditor : Editor { ... private static MyObject myObj; ... } I'd like to ...
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) { ...
1
vote
0answers
307 views

Unity 3d 4.6b New GUI system doesn't take touch when already a touch event is occurring in 3d scene

I know this is beta version but.. I have a Canvas->Button which works fine when I tap it normally. I have a joystick in my scene which is drawn by separate camera other than mainCamera. now, while ...
0
votes
4answers
1k views

sample project that mix unityscript and c#

I like the simplicity of unityscript, at same time I also like the plenty of c# library and open source projects. I prefer to put my model/controller/logic flow in unityscript using standard unity3d ...
0
votes
2answers
81 views

StartCoroutine function inside TriggerOnEnter2D not working - unity + kinect

So i'm using Kinect with unity to track user's hand movements, and let the user's hand act as a mouse, I have written the code to detect a collision between a button (sprite object) and the hand ...
0
votes
2answers
1k views

How to display a GUI text at run time in unity?

I'd like to display a GUI text at run time in my game for a second, so I want to know if it's possible to add or remove a GUI label to the scene at run time?
0
votes
1answer
419 views

Quit the application when clicking cancel button of Alert View in C#

Can someone guide me as to how can I make an application quit when you press the cancel button of an Alert View in C# code? Thanks I forgot to add that I am trying to quit application on clicking ...
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
1answer
87 views

Random Object in Array

I am using Unity. I have created eight different types of objects, stored in an array, and I am displaying them on the scene in a grid pattern with random order. The first four objects in the array ...
0
votes
1answer
62 views

Raycast doesn't point on the right direction

The raycast line im rendering is acting weird, it doesn't point where I want it to. I want it to point from the yellow object to the selected one but it draws it at another position. Here is my ...
0
votes
1answer
57 views

How to make it two seconds for Time.time?

var targetscript : Diamond; var red : Color; var orange : Color; function Start () { gameObject.camera.backgroundColor = red; } function Update () { if (targetscript.score > 4) { ...
0
votes
2answers
325 views

Instantiate prefab randomly but not in already occupied position

I want to generate bubbles randomly on screen. When a bubble is generated in one place then other bubbles should not be generated near its radius 1 area, so they can not collide or trigger with any ...
0
votes
2answers
43 views

different Scenes but each of them loads per frame

well i want to have something like restaurant that divided in 3 sections.and the user can switch between these but every Scene loads every frame.for example the character is in the first section and ...
0
votes
1answer
195 views

Unity3d : Make prefab follow raycast hit

I've been trying to make a weapon script which fires a projectile (prefab) straight forward.I added to the bullet the first script shown here.And the second one to the main camera.The problem is that ...
0
votes
4answers
954 views

Scripts won't affect clones - Unity3d

I made a script which swaps two game objects on click.But the script won't work because the objects are actualy clones of the original prefab. This is the script (UnityScript): #pragma strict var ...
0
votes
1answer
166 views

Free Look Camera Like Arma 2 while pressing ALT [closed]

I'm trying to create a simple script that give me the possibility to rotate the camera while pressing a key. So, in a pseudo-code way, how I can intercept the Input event and limit the player's ...
0
votes
1answer
326 views

Increase animation speed according to the swipe speed in unity for Android

I have the animation done through Maya and brought the FBX file to unity. Here is my code to calculate the speed of the swipe: Vector2 speedMeasuredInScreenWidthsPerSecond ...
0
votes
1answer
2k views

Unity3D animation trigger reset

How can I reset conditions for animations using an animation controller? I have a door that will open when a boolean property in a script is set to true. This then calls setTrigger on the animator to ...
0
votes
1answer
185 views

How to play a video on a TV model inside a game?

I am new to Unity3D. I need to know how can I play news when I switch on a TV using any scripting language in Unity3D ?
0
votes
2answers
133 views

Unity3D JavaScript/.NET code throwing compilation error with a List-thingy [closed]

So, I do this: var intlist:List.<System.Int32>; intlist.Add(1); And where I say intlist.Add(1) I get: NullReferenceException: Object reference not set to an instance of an object Weird, ...