Unityscript is one of the scripting languages available for the Unity engine (other languages are C# and Boo).

learn more… | top users | synonyms

-2
votes
0answers
41 views

First person bullet not shooting

Instead of spawning from the barrel the bullet just appears about halfway down my gun and just sits mid air? #pragma strict var PrefabBullet : GameObject; var speed = 100; function Update() { if(...
3
votes
2answers
105 views

What is wrong with my Chest script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script. #pragma strict var Text : ...
1
vote
1answer
27 views

How can I use a display as a background in unity?

I have a dancing game that I am trying to make and I have a stage where a character dances and a script to switch cameras inside that stage. What I am trying to do is set those cameras to display 2 ...
0
votes
1answer
48 views

UNITY3D How can my capsule rotate with my camera?

I'm new to 3D game development in Unity. I'm using Unity5. I've created a first person character controller that can move using WASD and I've created a crosshair along with a mouselook script. Here's ...
1
vote
3answers
90 views

How to Display hints to user when he is inactive for more than 5 sec in unity?

I have made a 2D Game using unity in which user has to select objects of similar color and now i want to display hint when user is unable to select the color for more than four seconds. I want ...
1
vote
1answer
72 views

What's wrong with my animation trigger script?

So I am making an RPG and I am setting up the player. I am trying to trigger an attack animation by pressing a button. I wrote this down and I get an error that says "Expressions in statements must ...
0
votes
1answer
55 views

my android game works very well on unity editor but not on device [closed]

Im working on a android unity project. My game works very well on the editor but, when i build it and run it on blue stacks emulator, it starts working corruptly. Bullets shoot twice in a time. When ...
1
vote
1answer
51 views

How to stack sprites?

I am currently working on a 2D game in Unity, I am using Animation Controllers / Animators for the different slots of armor on the character. The scripts set the Animation to the player object and ...
0
votes
2answers
37 views

How to use prefab only when in inventory game object?

I created an empty game object named "inventory", whenever I click on an object it transfers into that game object : and I got this far with the script: //Transforms public Transform Knife; //will ...
-1
votes
3answers
165 views

A python script controlling a Unity game

I wish to build a simple game in Unity such that the objects in the game can be controlled via a Python script (or a code in any other programming language). Is this possible? If yes then how? If no ...
1
vote
2answers
84 views

How to use touch screen for movement instead of keyboard narrow keys

I wrote this code and run the game on my desktop, now I need to build this game for android and I need to change to touch to move the player, what it should be changed in the following code and what ...
0
votes
0answers
92 views

Player character not moving

i am trying to make an fps game but my character won't move. i have tried different scripts for more than a week. Any help will be appreciated. Thanks! using UnityEngine; using System.Collections; ...
0
votes
0answers
32 views

plane bend problem

I thought to make the objects to view in the direction where the camera faces. But i have encountered a problem, When the camera goes near to the object, It bends. I don't know how to solve it. Here ...
1
vote
2answers
48 views

How can I select a object (canvas) with tag using Physics.Raycast?

I made this C# script, becase I want select a Button of the menu(canvas) for choice the dificulty of the game, but I don't want select with mouse I just want select with Aim, and I made this script ...
-3
votes
2answers
90 views

Is it possible to use Java as a scripting language in unity? [duplicate]

I wonder if its possible to use Java as a scripting language in unity to create a basic 2d game?
0
votes
2answers
65 views

How to make the wheels rotate depending on the speed of the vehicle

I want to know what the right formula is, or a way to make the wheels rotate with the speed of the vehicle? What is the standard way to make wheels look realistic and natural? Do developers use other ...
0
votes
0answers
57 views

how to simulate tank tracks(something that is around all wheels, dont know what is called)

im trying to simulate the part of tank that rotates around all wheels and i dont know what is a good way to do that. can you give me some hints to do that?
-3
votes
1answer
56 views

Why do I have to do minus-equals for the x-coordinate but plus-equals for the y-coordinate?

I found a simple script in C# in Unity5 to make the camera follow the mouse: xRotation -= Input.GetAxis ("Mouse Y") * lookSensitivity; yRotation += Input.GetAxis ("Mouse X") * lookSensitivity; ...
-3
votes
2answers
174 views

what is perfect manner to load scene and than player position.? unity 5.3

Here i have problem with scene and object position. My problem is position of object/player changed after load scene. I don`t know why this happens?. I have saved my object position with "playerprefs"....
1
vote
1answer
45 views

Unity3d Transfer of value from one script to another

Script 1 public class enemy : MonoBehaviour { private Vector3 Player; private Vector2 PlayerDirection; public float Xdif; public float Ydif; private float speed; private ...
0
votes
1answer
61 views

Unity5 - Create navmesh for a random generated environment

I am following this tutorial to create a game with random generated mazes: http://catlikecoding.com/unity/tutorials/maze/ I want to add some monsters to roam around the newly created maze. How can ...
0
votes
2answers
49 views

how to access base UnityEngine function of object form other class

I want to know is it possible to access functions of object like Start, Update,OncollisionEnter of other objects class in another class. if the answer is yes please tell me how can i do that. Thank ...
0
votes
2answers
61 views

timeScale=0 doesnt stop all prefabs in unity

As expected timeScale=0 can be used for stopping the game or pausing but when i make timeScale equal to 0 some prefabs still move and they can shoot bullets but addforce doesnt effect to bullets and ...
0
votes
1answer
213 views

How can I simulate tapping on touch for Android?

I'm searching on Input.Touch properties to find how can I simulate tapping on touch for Android. Something like Input.getmouseButtonDown() on mobile.
0
votes
1answer
102 views

Can I use JavaScript for Unity 5? [duplicate]

Sorry for my bad English. I wanted to know how similar is JavaScript with Unity Script. I know that Unity Script is not JavaScript and it was done for marketing purposes but I just wanted to know if ...
1
vote
1answer
97 views

Keep a rigidbody velocity constant

I have a "board" with a ball (rigidbody) moving over it and colliding with obstacles. I want its velocity magnitude to remain constant throughout time. How do I achieve this? What I've tried/...
0
votes
1answer
99 views

Object spawn only on Server in multiplayer unity3d game

In my game I have an object let say food, whoever eat that food that player will spawn one more element. I am sharing code here :- I am checking collision in Update. Following code is working fine on ...
0
votes
2answers
69 views

Pass Vector2 to Instantiated GameObject

I am trying to get an AI sprite to randomly shoot a SINGLE bullet while walking around. This is a 2D Top-down perspective. The sprite can move up, down, left and right. It randomly changes directions. ...
0
votes
1answer
91 views

Script for non-stop enabling/disabling “Is trigger” on collliders2d in Unity3D?

I had asked before that I have a problem with too many colliders in one spot and that some upgrades of towers I have are buggy due to that. It has come to my notice, that whenever I enable the "Is ...
0
votes
0answers
16 views

Displaying a timer ontop of a duplicated gameobject? (Unity2D)

So I have a timer which has for example 30 seconds and when it's over it destroys my gameobject. I can make I wonder how can I take this timer and display it ontop of every one of these gameobjects? ...
0
votes
0answers
22 views

JavaScript — Unity Movement Bug

Hello fellow programmers ! I have been working on a game lately and It's going pretty good. Today I decided to make a new car for it since it's a racing game. When I was modelling the car I ...
0
votes
1answer
51 views

Access to varibles in other attached gameobject script is ambiguous

I'm trying to create reusable scripts that I can drop on my GameObjects. I am currently trying to figure out how to build a projectile script. Ideally, I want to be able drop this scrip on an enemy, ...
0
votes
1answer
55 views

Camera bounds on different resolutions

I tried to search different solutions but also due to the lack of knowledge in camera handling I found none fitting my needs. The situation is the following. I have a 2d game structured in ...
0
votes
2answers
61 views

Sprite doesn't move

Trying to create a 2d Top down random movement. I have the blendtree setup so that it faces the sprite in the right direction. However, I can't get it move right. It just flips back and forth between ...
-1
votes
1answer
617 views

How to display text when mouse hover button in Unity 3D

I have a scene, where a panel containing 24 buttons. I need to show some piece of text when hover a mouse cursor over the button. For example, for detecting clicks, I'm using onClick event trigger, ...
0
votes
1answer
44 views

Can 2D Rigidbodies detect collisions with 3D Box colliders?

I would like to know if Rigidbody2D's can detect collisions with 3D Box colliders and/or normal rigidbodies. I seem to have a problem where my 2D Colliders don't detect collision with my 3D Cubes. :...
0
votes
1answer
38 views

Align UI element to gameObject in 2D

I have a 2d game where I want to display UI element perfectly aligned to specific gameObjects. I have an ortographic camera and I used to Camera.main.WorldToScreenPoint() function giving it the ...
0
votes
0answers
39 views

Unity – Recording data for a behavioral experiment?

I am conducting a study using Unity and Oculus Rift and I need to collect the data from my subject. My participant is moving in a 3D maze created in Unity and using the Oculus. At any given time, I ...
0
votes
0answers
25 views

Add script to created gameobject via script

GameObject.AddComponent Hi, I have this c# code. It is creating random cubes and spheres. I have a script named "destroy". I want to add this "destroy" script to below code. I gave new material but ...
1
vote
1answer
141 views

How do I snap the Unity camera to a 2D, tile-based map?

I have a 2D, tile-based map. I want to be able to control the number of visible tiles on the screen vertically and horizontally, regardless of resolution. I want the player to be able to move the ...
1
vote
1answer
88 views

Unable to move mouse cursor while pressing keyboard button

I've a player to which I've attached character controller and two scripts - Controller and MouseLooker to control the player movements but when I try to move my mouse cursor while pressing keyboard ...
0
votes
0answers
65 views

Conversion from .dae to XML for 3D Models in Unity BuildR

My partner and I are trying to import .dae files from Sketchup as well as 3DS Max into Unity's BuildR extension. Collada a.k.a. .dae files have an XML-based schema so we incorrectly assumed they would ...
0
votes
1answer
74 views

How does Color.Lerp works?

I want to understand how does Color.Lerp works in unity. According to this page it is quite clear to understand how to use it but I'm interested in how it is implemented. Does it work on RGB channels? ...
1
vote
1answer
83 views

Why transform.find() does not need actual object[unity]

I m new to unity and C#. I suspect that transform.find() function below does not need actual object reference like player.transform.find() because it transform find is already applied to the ...
0
votes
1answer
86 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 ...
3
votes
1answer
112 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
1answer
70 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=...
-1
votes
1answer
183 views

increase and decrease coin count

I am working in coin system. if the player get the coin it adding to +1 coin. after game over i want to store the coins. if the player again earn coin means the new coin want to add with existing ...
3
votes
2answers
170 views

How to avoid Walls in A*

Well I had a problem with the implementation of my A* algorithm in C# for unity, and I don't realize how to prevent the diagonal movement and the cross walls, I had the next code, the print line's are ...
0
votes
1answer
15 views

New textblock after click on button

I have made a box where you can type in your name in unity. After typing your name you can click on the button. Clicking on the button it will copy the string that you typed in within a sentence. so ...