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

learn more… | top users | synonyms

1
vote
2answers
22 views

Get the current time of animation using script Unity3d

I want to know the current time of the played animation using script in Unity3d. I tried using currentState.normalizedTime but this time is not the time of the animation, like it's the time of the ...
0
votes
0answers
46 views

Unity3D - Unable to attach script to GameObject prefab at runtime

I've got a script that manages a scene browser within my application where I'm hoping to generate a new button instance for each scene found. I've put together a button that I've made into a prefab ...
2
votes
0answers
50 views

Moving a character based on a list of Vector 3's

I have a client server scenario. On the server there is an AI character who chooses a random point on the map and pathfinds to it, when at that point it chooses a new point and pathfinds again etc. ...
0
votes
0answers
41 views

Saving runtime animation Unity3d

I have a .fbx file and I matched it with a Mecanim. During the run time I modify some of the joints rotations, and I wonder how I can save the whole animation on a file to include the modifications I ...
0
votes
1answer
18 views

2D Lock x Axis on character

I am creating an endless runner with a flying character. I want to lock any movement in the x axis so that the character object can only move up and down but still move forward through the scene. I ...
2
votes
1answer
33 views

Unity sprites and layouts

I am trying to learn Unity for a simple board game. The question is, is it possible to use grid layout group (or any layout component) with sprites? The goal is to fit a board into my view regardless ...
-1
votes
0answers
43 views

camera following with strange behavour

I'm not sure why my code doesn't work.When I run it my camera just rockets off into space. using UnityEngine; using System.Collections; public class CameraFollow : MonoBehaviour { public ...
-1
votes
2answers
53 views

How to make different 2 object's collider with the same location in Unity 2D

I have made my own game, but I can't change the object's collider properties from the interface. I can't click on the expand button, because behind it there are other colliders. How could I change ...
-1
votes
1answer
59 views

Unity Ui slider volume control

I have the ui slider to control my volume, I have my slider to control all the volume of the game. I have make it so when the main slider change value all the other slider change with it but when I ...
-4
votes
0answers
87 views

Unity - C# How to create very Big Number? [closed]

public static float a = 9999999999999999999; This is the biggest variable that can create. but is not enough for me I need to get to this public static float a = ...
0
votes
1answer
37 views

How do I make one ui slider control all of the game audio?

I use the ui slider to control how loud is the game, what I want to know is how to make one ui slider control all of the game audio?
0
votes
1answer
28 views

How do I use playerprefs to make ui slider keep the sound settings?

I have not use playerprefs before, I want to know how to keep the change of the audio when the player change it throughout the game.
0
votes
1answer
18 views

Error BCE0043,BCE0044 and UCE001 [closed]

I got my code right here: #pragma strict var hSliderValue : float = 0.0; function OnGUI(){ hSliderValue = GUI.HorizontalSlider (Rect (25, 25, 100, 30),hSliderValue, 00, 1.0); ...
1
vote
3answers
107 views

In Unity, how do I make separate mute buttons for sound-effects and music?

I'd like to have a button to mute game sounds and another to stop the game music. How can I do this?
-3
votes
1answer
40 views

Collision detection console log errors?

So the code down below is supposed to load the next scene once the player touches the flag which the code is attached to. I've made sure that is trigger is checked and yet I'm still getting errors ...
0
votes
1answer
48 views

How do I have different colliders against different objects? Unity

Say for example I have a ball, I want the sphere collider to be a certain radius when it comes into contact with one material (material A in diagram) and a different size when it comes into contact ...
1
vote
1answer
72 views

Smooth rotation Unity3d

I have an animation and I modified some rotations of some bones in the animation at a certain frame. What I want to do is how to make the animation in the next couple of frames interpolate smoothly so ...
0
votes
1answer
33 views

Material not changing Unity3d [duplicate]

I have a MeshRenderer mr public variable in script1. I dragged mesh1 from the assets in the mr place in the inspector of script1. mesh1 has a material mat1, I try to change this material to mat2 using ...
0
votes
1answer
102 views

Display and render only a specific object in wireframe in Unity3D

I want to know how to view and render a specific game object (mesh) in wireframe, not the whole scene. I can change the scene to wireframe using GL.wireframe but the problem I want to view and render ...
0
votes
3answers
91 views

How to change the gravity with a click

How to change the gravity of a ball upward with a click Then change it again downward with another click And so on In unity
0
votes
2answers
67 views

Color submeshes in unity3d

I have a main_mesh that has 10 submeshes, I wonder how I can change the color of of these submeshes to a different color (e.g submesh1 will have a red color, submesh2 will have a blue color,...etc). ...
0
votes
1answer
56 views

Access different vertices of a Mesh Unity 3d

I have a mesh and I want to color each group of vertices with a certain color. If anyone could please advise how this can be done in Unity using coding?
2
votes
2answers
205 views

How to apply a script to multiple Objects in Unity?

In Unity, I've almost 200 or more objects. I wish to apply single script to all those objects. I'm a beginner & learning scripts in Unity. Edit: At the time of editing the scene itself.
1
vote
1answer
52 views

Character controller going down slopes

When I go down slopes with character controller, if the speed is too high, the character just flies off the slope and lands at the bottom. I want my character to "stick" to the slope rather then just ...
0
votes
1answer
24 views

Scaling of a bone is working while rotation is not Unity3d

I'm using Unity3d and I'm trying to rotate the left leg bone of an avatar but it is not working although scaling is working well. This is the code used for scaling and is working perfect: ...
1
vote
1answer
111 views

Unity: How to get a GameObject programmatically?

I have created a prefab. In Unity Scene editor, I dragged the prefab into the scene and named it PrefabA (this is a GameObject instance of the Prefab). Now, I need to update the PrefabA position. How ...
0
votes
3answers
82 views

How to check distance between two different vectors?

So I have a very basic racing game, where I would like the car to stop once it hits the finish line. Respectively when the distance between the car and the finish line hits or goes under 0 the car ...
2
votes
1answer
196 views

Is Physics2D.BoxCast a safe alternative to a row of raycasting?

Raycasting in rows is a common practice. Is using the Physics 2D BoxCast function a good alternative to using multiple raycasts spread out (an example use being collision detection in a custom ...
1
vote
1answer
141 views

What would cause my script generated buttons and text to show in Unity and not on my phone?

I am using Unity 5 and the built in GUI tools. My static GUI shows up just fine which makes me think it's not a text/font issue or some such. Again, it all looks good in the Unity editor when I hit ...
0
votes
0answers
55 views

Unity - UI Mobile - Script Generated buttons/text not seen?

I'm trying to generate some buttons and text dynamically with Unity 5.0 All of my code seems proper. It looks great when I play it in the editor. Everything is generated and placed and sized as I want ...
1
vote
2answers
52 views

player does not collide with walls unity 5

I just started a new proyect with a personalize first person controller, like arrow move style, it worked, but when I tryed to collide it with walls it did not happen, I tryed adding a capsule, then ...
-2
votes
1answer
90 views

how to change trail renderer start width dynamically by script in unity?

I created a prefab that contain a trail renderer to make a drawing sprite in GUI, then i put it into a gameobject in a script. I want to change the start width or end width of the trail renderer ...
0
votes
1answer
96 views

How do I make the ui button to move my character? [closed]

How do I make my character move left,right and jump when click ui buttons using this code? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public float maxspeed = ...
0
votes
0answers
22 views

How do I make Ground Check stop rotating with the character when it rotate? [duplicate]

How do I make my character routice without Ground Check rotating with it, but still follow my character? Code: using UnityEngine; using System.Collections; public class Player: MonoBehaviour { ...
0
votes
0answers
18 views

Character fixed angle? [duplicate]

I want my character to rotate so I turn off fixed angle in Rigidbody 2D, but the problem here is that I can't jump in any other angle except for the angle where I have my groundcheck. Can anyone help? ...
0
votes
1answer
36 views

How to write a script for circular motion?

Сan any body explain me the script for the tangential motion,so that when i cut the rope circle should move tangentially:
0
votes
0answers
38 views

Character can't jump in other angle with fixed angle off

I turn off fixed angle so my character can rotate, but it can only jump in 1 angle but I want it to jump in every angle. How do I do that? Code: using UnityEngine; using System.Collections; public ...
2
votes
1answer
89 views

Unity 3D - Rotating an object in relation to its velocity

I am currently trying out Unity 3D and I've run into a problem. The problem is I have a car that moves along a road and then when it reaches a corner I would like it to turn the corner and have the ...
2
votes
1answer
64 views

Multiple enemy collidiers

I currently have an enemy that upon collision kills the player with a kill script, I want to add another collider that acts as the visibility radius for said enemy. However, when adding another ...
0
votes
2answers
173 views

How do I make my character jump in any angle?

My character is a square which can spin in any angle but it can not jump in certain angle Can anyone help? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public ...
2
votes
2answers
55 views

Unity2D Sprite flips camera when moving left and right

I am using the Unity Engine and coding in C#. I have a sprite as a parent with a main camera as a child so that the main camera follows the sprite. However, when pressing 'A' and 'D' to move the ...
1
vote
2answers
131 views

How to move a cube withour rolling it?

I am trying to move a cube with my keyboard on a plane surface. However, the cube always rolling instead of moving. How could I slide the cube on the plane? What I have done: I added a plane game ...
1
vote
1answer
85 views

How do I make my character stop going left? (Unity)

So I have this code and my character can go left, right and jump. I don't want the character going left , so how can I remove that. (I'm very new with coding) using UnityEngine; using ...
1
vote
1answer
363 views

Animator has not been initialized

My animation is working but unity keep saying that my Animator has not been initialized error Here my Code: using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public ...
0
votes
0answers
60 views

Errors Generating A Plane Mesh Using A Script In Unity

In unity I have a script which is attached to a game object with a mesh filter. The purpose of the script is to generate a flat plane of 100x100 vertices. The code for the script compiles in ...
0
votes
1answer
82 views

Trying to get reference to Button in Javascript Unity3d

I've this simple script in Unity3d: #pragma strict public var topLeft : UnityEngine.UI.Button; public var topCenter : UnityEngine.UI.Button; public var topRight : UnityEngine.UI.Button; public var ...
0
votes
1answer
137 views

How do I use rigidbody2d.AddForce to apply a force in the direction the object is facing?

I'm trying to create a thruster on a spaceship. It should add this thrust in the direction the thruster is facing, but I am at a loss on how to get that direction and send it to AddForce. Am I even ...
1
vote
1answer
86 views

Understanding animations of controllable characters

I am a newbie trying to learn basics of Unity3D (5) before starting to do the real thing. Even though I tagged it as Unity3D, the logic should be the same for every kind of game engine. So I will be ...
0
votes
2answers
329 views

Unity C# 2D Platformer Enemy Patrolling

I'm setting up a basic mario-like 2D Platformer and i'm trying to give 'enemies' a patrolling path on a platform. (just like the turtles in Super Mario Bros). All they do is patroll from left to right ...
0
votes
1answer
265 views

how to Move Player on “Z” Axis 2D Movement

first im little new to unity..currently im working on 2D game mobile game.and im using Stranded Asset(Mobile) Single Joystick prefab to move Player..Currently my player move on X and Y axis. can any ...