This is not a general term for scripting in Unity, but rather it's own language (similar to JavaScript) available for the Unity engine (other languages are C# and Boo).
0
votes
0answers
10 views
The rotation along z axis is not changing to zero?
Code:
function Start(){
Cursor.lockState=CursorLockMode.Locked;
}
function OnGUI () {
transform.Rotate(0,Input.GetAxis("Mouse X"),0);
transform.Rotate(Input.GetAxis("Mouse Y"),0,0);
...
0
votes
0answers
30 views
How can I make my 2D sprite properly double jump?
I am trying to make my sprite, who is a little red box jump and then jump again while in the air.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
...
0
votes
1answer
18 views
Player prefs is not saving data with error Namespaces cannot be used as expressions.?
code:
var score:GameObject;
function OnCollisionEnter(){
PlayerPrefs.SetFloat("Score",score.GetComponent(Events).i);
}
Events is the script I assigned to gameObject score which contain the float ...
-1
votes
1answer
18 views
The value of animation parameter is not changing?
Code:
var click=false;
var anmtr:Animator;
function Update () {
if(Input.GetButtonDown("Fire1")){
click=!click;
anmtr.SetBool("clk",click);
}
if(Input.GetButtonUp("Fire1")){
click=!...
0
votes
2answers
49 views
Animations locked the rotation of character [on hold]
I have a character when give him any animations and a script which take him rotation with 90 degree on his y-axis ,So the script doesn't work even if the scene is paused and give him 90_y-axis ...
1
vote
3answers
72 views
Update and FixedUpdate together
I know some differences between Update() and FixedUpdate() and recently I have used both functions in one script. The code is working, but I have a question:
Does using both of these functions cause ...
0
votes
0answers
65 views
I try to make a Unity Curved Shader with shadow Effect?
I try to make a curved shader with shadow effect I got a existing curved shader in github and it has no shadow effect i try to modify it but i couldn't find any appropriate solution.
The shaderor ...
0
votes
0answers
25 views
What is unity_builtin_extra?
What is unity_builtin_extra?
I am new in unity, I built an apk of sizes 72MB and 36Mb contained by unity_builtin_extra would you please help me out to resolve this issue?
Thanks
-1
votes
0answers
35 views
how to make a cube to change color by clicking a button in unity? [duplicate]
i used this below code to change the color of a cube if i pressed a button. but its not working.i have added this code to cube and in button i have attached this script and function. if i pressed the ...
7
votes
0answers
227 views
Why does Unity Eventsystem lag on first touch?
Hi I am making a very simple simple platformer game for android devices. I am using Unity's event system for player movement. The problem is when I touched the button first time there is a lag (hiccup)...
0
votes
2answers
42 views
Why I have to press the button twice to deactivate the GameObject for the first time?
game engine:unity3d
scripting language: unityscript
code:
var setmenu:GameObject;
var settings_menu:boolean;
function Start() {
settings_menu=false;
}
function ...
2
votes
2answers
111 views
Unity Rigidbody2d jittering movement in the y-axis
As said, rigidbody moves fine, even smoothly in the x axis.
Problem comes in on the y axis. Whenever the character goes up or down, it noticeably shakes.
Additional Info:
Unity 5.6
Using linear ...
0
votes
1answer
27 views
How to add a volume bar like YouTube for iOS?
I am almost done with my game in Unity 5. However when the player presses Volume Up/Down, the iOS (version) shows the standard UI to show volume. Android has it's own (looks better on Stock).
I want ...
0
votes
1answer
49 views
Unity Network how to move noplayer object from client side
When i drag a nonplayer object from host, client can see it, but when move the object from client, host player doesnt see any changes. How can i fix it?
using System.Collections;
using System....
0
votes
1answer
70 views
How do I use coroutines to animate properly?
I have a coroutine, which I called from the Update() method on every click.
First, I call AddTrunk() to add to my trunkList, then I use my coroutine to move the animation for 0.3 seconds. After 0.3 ...
0
votes
0answers
22 views
How to Access specific MipMap Level from RenderTexture directly?
I need to access the top level pixel of Texture's MipMap. This is what i am doing now:
m_ShellNormalTarget = new RenderTexture(m_WidthBuffer, m_HeightBuffer, 32, RenderTextureFormat.ARGBFloat);
...
0
votes
0answers
16 views
Add translation at each animation cycle loop in Unity
I have a running animation. It already contains root animation. At every loop, it jumps to starting position.
What is the best way to add a translation every time the animation loops?
1
vote
2answers
44 views
Game (Physics) work in Unity Editor/Remote but won't on Android?
I have a script attached to a car game object that allows the player to tap the screen and then accelerate, the game object has a RB2D and collider set to it , it works fine in Unity Remote , but when ...
-2
votes
1answer
105 views
C# syntax for “This button is interactable”?
What should be the C# syntax for the condition if (This Button is interactable)?
I have a script attached to the button, Which has to run only if the button is interactable.
Thank you in advance!
0
votes
0answers
36 views
How do I program walking inside of a GPS map? [duplicate]
I am a relative newcomer to game development. I was just thinking of a cool idea for a fun project, and I was wondering how one would code a program that would map a sprite walking on a GPS map. When ...
0
votes
1answer
65 views
Unity 3rd person Camera and restrictions done wrong
I have made a camera that rotates around my player according to an Xbox joystick input. The camera is a child of a gameobject called focus on the player. To move the camera the gameobject is rotated ...
2
votes
1answer
130 views
Minigame inside game in Unity
I am developing a 2D game, and using an option of the game, it will open a minigame. I planned to set it as a separate scene, but I don't know how could I load a Scene into another scene as a window.
...
1
vote
0answers
38 views
Second Animation is not working after Collision?
I want to show an accident of Character with car. so I wrote this code
and in update function I wrote this...
if (Once) {
Criminal.GetComponent<Animation> ()....
0
votes
1answer
47 views
Why is my button script not working?
Okay so i'm new to C# and i made this script. The goal i have in mind is that when the player is on the button and presses a button ( W in this case ) the button is switched from on to off ( or vice ...
0
votes
1answer
29 views
Can not access GUIText in instantiated prefab
I have a prefab with the following component structure:
Block
Quad
RawImage
GUIText
When I instantiate it and try to access the GUIText, I get the output of 'null'.
Here is the code, I am using to ...
0
votes
1answer
87 views
Why is my enemy kill code not working? [closed]
I'm trying to make an enemy for my game, and everything works, except for the bit of code where the enemy is supposed to die.
My player attacks but nothing happens.
I filled in the prefabs, I have ...
0
votes
0answers
77 views
Disable global fog from camera [duplicate]
Does anyone know how to disable global fog from a particular camera?
I have two cameras in my scene; one is a mini map camera, where I need to disable global fog.
I have checked this answer and the ...
0
votes
1answer
74 views
Unity swapping textures not working, weird?
I made two textures for my 3D game character. I can use both of them by dragging them on my player but I want to do the same through code. I searched and found that people are either using:
1) rend....
0
votes
2answers
396 views
Unity 5.3 with C# - Toggle Sound On/Off
I'm working with Unity 5.3 with C# as code editor
These are what I have :
I have 2 scenes in my project : home and options. I have bg object on both scenes. Both bg objects have Audio Source ...
0
votes
1answer
85 views
Unity - Permanent force when a rigibody without gravity hit a collider
I'm actually working on a 2D game, and stumbled upon something rather strange in Unity. The issue occurs pretty specifically, so the description will be long:
In the scene, I have a flying object, ...
0
votes
1answer
46 views
C# Script file is not showing in Onclick Event in Unity 5.0.4f1?
I uploaded the levelLoader file to the gameobject. Still, when I drag the script file onClick Event, the no function is null. Why? Can anybody help me?
C# code:
using UnityEngine;
using System....
1
vote
2answers
42 views
In Unity - Move a GameObject at Animator State
I want to move one of my GameObject to a different vector 3 position, when animator transit to a new state. How do I do it? Also there shouldn't be any delay.
0
votes
0answers
198 views
Shoot diagonally with Unity 2D
I'm working on a shoot script where the player can shoot right, left and to diagonal directions like right up and right down.
All of this I can make, the player shooting to left, right and right up ...
0
votes
0answers
42 views
Calculating Jumps in Unity3D
I'm currently learning Unity, and having a hard time when making a Character jump.So I can jump and move fine, but most of the time is just: Search for tutorial, understand a few things, adapt code ...
0
votes
1answer
91 views
How to start simple game development with Unity 5 [closed]
I want to start developing games with Unity because it's easy to learn, but I don't know where to start.
My questions are:
- Which preparations should I make for a game?
- Are there any tips and ...
0
votes
2answers
424 views
Unity Random.Range not repeat same position
I have this code that generates blocks in random position and it works but some times it generates blocks at the same position ,how can I fix it?
var dupeobject : GameObject;
function Start(){
...
0
votes
2answers
35 views
Character doesn't move anymore after gameover and clicked play
When my character died it displays gameover and goes back to main menu, then if I clicked play I can see my character however I can't make it move anymore. Any suggestions?
For game over:
#pragma ...
0
votes
2answers
27 views
My player died and if i clicked play in the main it will go to the last scene and say gameover [duplicate]
I am trying to make a gameover scene where in if the player is game over The game will go back to the main or start up then when I press play it will start new game however if i am game over and go ...
0
votes
2answers
60 views
Any idea to be able to make the character still continue the game until no heart left
I am newbie I am making a 2d game in unity 3d my code for the character game over is this.. I can get the heart less one heart if game over but turn back to five again I just want to decrease heart ...
0
votes
1answer
177 views
Why is perlin noise generating flat terrain in Unity?
I am trying to generate terrain using perlin noise however the terrain being generated is a plateau. Here is the code that I'm using:
var xlength = 65.0;
var ylength = 65.0;
var scale = 4.1f;
var ...
1
vote
1answer
44 views
Slow down in the same time over different distances
I'm trying to slow down a object over different distances in the same time, say 3 seconds.
My slow down code is.
function lerpSpeed (speed: float, lerpSpeedTime: float)
{
...
1
vote
0answers
269 views
2D Unity: How to make a enemy jump from a navmesh platform to another?
I'm currently working on a 2d platformer, however I came across an issue where the enemy moves within a certain range of the platform.
In this case I use a navmesh to limit the enemy's movement ...
0
votes
0answers
30 views
Prevent gameworld clicks working on Editor but not on device
I'm having a small problem with my game. I have a UI label to act as a pause button (with EventSystem/Trigger in canvas), but if you click it, the game reacts too, so I have the following code to ...
0
votes
3answers
200 views
How to move a object to a target point like sine wave in 2D world
I want to move my gameobject to move point A to target point B like sine wave, I have used Vector2.Lerp but its just straight line.
so far I tried many ways and I managed this
//sine wave
vLastPos = ...
0
votes
1answer
71 views
Building a game project in C# for Unity in VS?
Say that a project needs to be created from scratch for later use in Unity, for scripts. What is the ideal way to setup this without using a template in Visual Studio?
Can this be created in C# with ...
0
votes
1answer
98 views
For each array within array using UnityScript
I am trying to randomly generate some values for a character using Javascript in Unity.
I have two arrays, one for colour, and one for body type. I want to get one value out of each array, randomly, ...
-1
votes
2answers
81 views
How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d
I can't get my gameobject to pause or unpause in the scene in Unity3d.
I need the game to pause for a couple of seconds maybe longer than unpause
by itself. Here is my script :
using ...
-1
votes
1answer
61 views
How do I make Text Mesh appear five seconds later and disappear from the scene in unity3d [duplicate]
I have a text mesh in my scene. I don't want the test to show right when the scene starts . I want to text to show up in the scene five or ten seconds later on the screen and than the text disappear ...
0
votes
1answer
32 views
FPS Android game that moves the gun as user swipes the screen
I am Making a First Person shooter game for android. Gun moves in all directions I swipe left right up or down. But the speed is so slow. How can i increase it's Speed.Here is my code.
void ...
5
votes
2answers
1k views
How to keep a round body rotating without rotating it's center
I want to make a game in Unity in which the Player is a sad star. I want to have the points (The "arms and legs and head") of the star to rotate like a circle but to keep it's face (which is in it's ...