A scripting language used by the Unity game engine. It is often mistakenly referred to as Javascript. UnityScript is only loosely based on JavaScript.
1
vote
1answer
16 views
Object destroys and doesnt play particle system
I'm new to scripting in unity and I have a script that destroys an object when its health reaches 0
var EnemyHealth : int = 10;
function DeductPoints (DamageAmount : int) {
EnemyHealth -= ...
2
votes
1answer
57 views
Unity (C#) -> Kotlin <- Coroutines
I'm experimenting with Kotlin for the first time and would love some help.
What the code below does is pause execution of the current function without sleeping the executing thread. The pause is ...
0
votes
1answer
32 views
How to make a linking line in unity
Can I get help on how to make the dots link together upon User touch like the in the following Picture ?
the line is connecting the 3 dots
0
votes
1answer
15 views
I want the background of panel scroll in unity5
I make a scene in unity5 with Canvas and added Panel into that canvas,I want to scroll background image of panel but could not find any reasonable solution for this, I know background scrolling is ...
0
votes
3answers
36 views
Unity / How to set Limit for enemy spawn?
I managed to spawn enemies but they keep spawning. How can I set a limit to avoid from spawning unceasingly?
I've tried to add spawnLimit and spawnCounter but couldn't manage it to work.
var ...
-3
votes
1answer
27 views
Continue running time in background unity and pop notification
I am developing a game in unity, I included the time in it after 5 minutes player will get 1 life and i want my code to pop up notification when the player gets the maximum lifes that is 10 when even ...
0
votes
1answer
24 views
Unity 5 // when enemy spawns , Enemy target is none?
I've got a basic AI script where I'll assign an object for the enemy to chase.
The problem is, when I turn the enemy into a prefab, the target assignment becomes blank and I cannot alter it while it'...
-1
votes
1answer
28 views
I need glowing outline around button in unity
I am working on a project in unity5, while I am making a menu contain buttons, I need button to make glowing outline, need help in this regard.enter image description here
same in the picture, I need ...
0
votes
1answer
35 views
How Create clicker game in unity 3d for mobiles?
i am new to unity and want to create 2d clicker game in unity. the concept of game is pretty simple there is four 2x2 grid images on canvas and this images shuffles randomly user have to click on ...
1
vote
0answers
31 views
How to Focus GUI.TextArea in Unity for Android
In Unity Editor, I could focus a GUI.TextArea by doing the following:
GUI.SetNextControlName("MyTextField");
m = GUI.TextArea(new Rect(0f, 0f, 100f, 100f), m, 64,style);
GUI.FocusControl("...
0
votes
3answers
14k views
Time Delay for a process in Unity 3D
I have to give the delay for the process to happen, which I am calling in the Update function.
I have tried CoUpdate workaround also. Here is my code:-
function Start()
{
StartCoroutine("CoStart");...
2
votes
2answers
34 views
How to make a game object appear through triggers from 3 different game objects
I am developing an AR app using Unity3D and Vuforia.
I did all the basics of AR and now in the process of completing it.
However, I am currently stuck at the triggers part.
I have 3 flashcards (...
1
vote
1answer
23 views
How to unite gameobject meshes?
Because of I made my house from the unity editor I can't remove this mesh borders. I tried MeshCombiner but it just connects all of the meshes in one mesh borders still exist. I know I can make it ...
-1
votes
0answers
31 views
strange errors in unity3d javascript, how do I fix them?
I am making a script for enemies in my fps game, but I get loads of errors and I don't know why or how to fix them. Please help.
#pragma strict
//for raycasting
var fwd: Vector3 = transform....
0
votes
3answers
34 views
One script for multiple buttons in unity 5
I am using Unity 5. There are 2 Buttons in a Canvas - YesButton & NoButton. I added only one script called "ButtonScript.cs" in both buttons as a component.
I need -
While pressing in YesButton, ...
2
votes
3answers
123 views
Create infinite loop in Unity with delay
I need to create a infinite loop in Unity without using the main thread? I saw some example, but it's not usefull:
while(true){
var aa;
debug.log("print.");
}
I want to add some ...
3
votes
4answers
3k views
Finding Line segment-Rectangle intersection point
Simply put, I have:
A viewport rectangle where (0,0) is the bottom-left corner, (1,1) is the top-right and (0.5,0.5) is the centre of the screen.
A point (a,b) which is outside of the rectangle.
...
1
vote
4answers
6k views
saving player information in an external file
This is the main menu in my first test 2d game in the world of unity :
I want to save high scores and if the player pressed the "Best Scores" button I want to show them the best scores yet ^^ , so I ...
0
votes
0answers
34 views
(Markerless) Augmented Reality and Rigidbodies
We've encountered a lot of problems concerning the use of Rigidbodies in (markerless) Augmented Reality. Our game is supposed to be a building game and when we spawn objects in front of the camera, ...
0
votes
0answers
22 views
How to get child canvas to correct position?
New to Unity
I have a child canvas HexGridCanvas. When I start the game, the child canvas is populated with spheres. See the image:
How do I get the canvas to be positioned to the left edge of its ...
4
votes
3answers
78 views
Unity - How to have two of the same GameObjects collide, destroy each other, and spawn a new GameObject at the target position?
So I want to have two balls collide, destroy themselves, and then have another ball spawn at their place (preferably with a specific velocity). When I try to attach the script to the ball, however, ...
2
votes
5answers
4k views
Merging two different texture into one in unity3d
i am trying to merge two textures into one in unity
the first texture is from a webcamTexture
the second is from a sprite using : gameobject.getComponent<SpriteRenderer>().sprite.texture as ...
0
votes
2answers
39 views
Is it possible to pause co-routines in Unity until a button is pressed in unity 3D?
I am trying to make a popup screen and I want to stop some code until a button is clicked on that popup screen is this possible. Would you show me some example code?
2
votes
2answers
510 views
how to add gaze input timer to trigger an action after gazing for 3secs?
I am new to unity and VR. I have been using google cardboard SDK to create VR apps in unity and am stuck at gazetimer. I want to trigger an action only if the user looks at any object for 3secs but ...
2
votes
2answers
1k views
Promises with Unity
I want a Character class, inheriting from MonoBehavior and exposing handfuls methods : Walk, Attack, ...
However, assuming that two components use these methods at the same time, I would like to ...
-5
votes
1answer
25 views
Unity3d how can i program my game?
I am creating an Android 2d game in unity3d game engine. I've created an endless map and a continuously moving ball is my character. I've got some pits digged on my platform. If the user clicks ...
0
votes
2answers
45 views
Unity3D: no idea how to use Quaternion.Slerp(); rotation becomes faster
I'm trying to make a simple game in Unity for GearVR. In the game I have a scene where the user can navigate through a list of items. An item can be selected if the user clicks while looking at one. ...
1
vote
1answer
57 views
How to let objects fall down continually
I have started learning Unity and want to let objects fall down and collect. So far I have just one object and it falls down just one time. How do i place in into a loop and let it fall over and over ...
0
votes
1answer
41 views
Unity www Loading local audio in iOS error
Error: Cannot create FMOD::Sound instance for resource \270,\216, (Operation could not be performed because specified sound/DSP connection is not ready. )
iOS Local audio path:var/mobile/Containers/...
0
votes
3answers
279 views
Stop count when game over and store value
For my new game in Unity3D, I created Javascript code that allows to count when the player is playing and display the value in a GUIText.
But I have some issues.
In the game, the count start and the ...
-2
votes
1answer
25 views
how to move a object from one position to another position through mouse click position
I was trying to make a bubble shooter type game play in unity 3D where ball will be go from its initial position to anther position through mouse click point like the image below
it will be very ...
1
vote
2answers
437 views
Collision work on pc emulator but not on android device
I have 2 objects with colliders. the sphere object("ball") should collide with the mesh("goal"):
sphere collider
mesh collider
they both non-kimetric.
i use the next code:
function ...
0
votes
1answer
20 views
What is the difference between the concept of Lobby and Room in Photon Unity Networking?
The title says it all.
I have tried reading documentation but couldn't figure out the basic difference between them and properties of each.
Thanks in advance.
0
votes
2answers
45 views
Drawing random paths with quadratic bezier curves
I want to draw smooth* and random paths that my objects would follow and I decided to go with quadratic bezier curves (but I'm open to other ideas).
My code is moving my objects in a random, but not ...
1
vote
2answers
593 views
Javascript in Unity for Oculus Rift
I just want to know, can I use Javascript to program items and a virtual reality world in Unity so I can implement it into the Oculus Rift? I need to do it for a research project. I would try C++, but ...
0
votes
0answers
27 views
Unity NetworkServer OnServerStarted
I am trying to setup a NetworkServer <-> NetworkClient in Unity
I prefer not to use the NetworkManager because it requires setting Online/Offline scene. I'd like the player to stay in the same ...
0
votes
1answer
37 views
Zoom in/out clicked area in Unity3D
I am new to game development and also new to Unity. I need to zoom and move camera to clicked position of object. Actually I have imported an object with sub prefabs and all of prefabs has 0,0,0 ...
0
votes
1answer
354 views
Raycasting Unity3d 3rd person shooter shooting out wrong
I'm trying to make the enemy follow my player if they're close to him.
I have made them follow my player if he's in front of them directly but this is not what I want. I want them to raycast his ...
0
votes
1answer
29 views
PhotonView.RPC() not working in Photon Unity
I have a method with [PunRPC] flag on it
public void getEveryOneScore()
{
//some Code
}
calling it this way
GetComponent<PhotonView>().RPC("getEveryOneScore", PhotonTargets.All, null);
Both ...
0
votes
2answers
5k views
Can't get rigidbody collisions to work in Unity3d with box colliders
so I am using Unity to create an Android game and I cannot get any collisions to work. Both objects have box colliders and one has rigidbody attached to it. When I hit play it just falls through the ...
-1
votes
2answers
29 views
Making an object(with camera) move passively
I'm creating a Vive VR Passive VR experience, where your in a space ship and without any controls, it moves passively through the whole solar system. It's not AI, there will be a predetermined ...
0
votes
1answer
34 views
Instantiated Enemy outputs double damage for every enemy spawning after him
So I'm making a FPS Survival game. I made a GameManager script which handles the Enemy Spawning part of the game. My EnemyAttack script handles the enemies attacking. Problem is, when the first enemy ...
2
votes
1answer
46 views
Unityengine.VR asembly referenceissue
I am new to Unity development with visual studio.
I have installed 5.4.2 version and opened one project and getting following error.
Assets/Holograms/Support/Spatial Mapping/SpatialMapping.cs(2,22): ...
9
votes
4answers
33k views
Raycasting to find mouseclick on Object in unity 2d games
I am trying to delete the object on which the mouse is clicked. I am making a 2D game using the new Unity3D 4.3. Here is the code I'm using
void Update () {
if (Input.GetMouseButtonDown(0))
...
0
votes
0answers
38 views
My player isn't jumping
Hello guys i made a game that's a cube jump from challenge to challenge and if the player touched the challenge game over so in unity editor its jump but when i download it apk the game works fine but ...
0
votes
1answer
29 views
Is there any way to use AddComponent with a script in Unity if there is no instance of that script in the game yet?
I need a way to add a script to an object that I just Instantiated. Ideally I could just set the script to add in the inspector. The problem is that I can't use
public Component scriptToAdd;
...
1
vote
0answers
39 views
Unity: how to set the mesh of a meshfilter
I am trying to build a script that allows me to set the mesh of a mesh filter to that of a 3D model.
I have looked around and seen various ways of doing it, none have worked.
I am currently trying ...
0
votes
0answers
20 views
How to add data into SQLite and show at different area in AR application using Unity?
I want to add a feature in my AR application that it takes input from input UI in unity, stores in local SQLite database and show the resultant data at point of interest.
Like Name, Address, mobile ...
0
votes
0answers
29 views
Can a declared function be inside the anonymous one in UnityScript?
I am trying to write an app in Unity. I thought that the similarity between the JS and US allows to use JS libraries inside. Seems I am wrong, or I don't get somewhat. So the file is JSmol.min.moJQ.js ...
1
vote
1answer
60 views
Set preference value in unity, Not able to get in android
I set preference value in unity using below code
rightJointPos = rightJoint.localPosition;
PlayerPrefs.SetFloat ("rigX", rightJointPos.x);
PlayerPrefs.SetFloat ("rigY", rightJointPos....