Questions tagged [unityscript]
STOP: this is probably not the tag you want. UnityScript is a deprecated language. For new questions about scripting in Unity, you probably want the tags "Unity" and "C#". Only use this tag for questions about legacy code written in UnityScript, the old JavaScript-like scripting language available until Unity version 2017.2.
318 questions
0
votes
1
answer
3k
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 ...
1
vote
1
answer
4k
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/...
-2
votes
2
answers
692
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
1
answer
481
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
1
answer
1k
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 ...
0
votes
1
answer
1k
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 ...
1
vote
1
answer
6k
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 ...
0
votes
1
answer
1k
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 ...
1
vote
1
answer
611
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
1
answer
1k
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 ...
2
votes
1
answer
1k
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.
...
0
votes
1
answer
672
views
Swipe and hold character movement not working
Heres my PlayerControl script
...
-1
votes
1
answer
630
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
2
answers
415
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
1
answer
24
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 ...
2
votes
0
answers
515
views
Record voice and Comparison prefab audio in unity
I am android programmer that i Comparison Entrance voice with ready voice(prefab voice) for example when you say hello >>>>>to analyze>>>>>if your voice == prefab voice >>>>>you listen hello(play ...
2
votes
0
answers
2k
views
In Unity, how do I make a 3D flight arc preview?
I'm stuck on how to make a preview trajectory for a projectile appear when holding a button. The trajectory should start at a certain position on the scene and end wherever the player points their ...
3
votes
1
answer
2k
views
How i can control button input android?
i am android programmer and i want control button input in android
for example i made a game that when you press back button in android mobile
nothing happens but i want quite from game.
This is how ...
1
vote
0
answers
530
views
Need to save UI.Image to png
I have ui.Image1 with Mask component and ui.Image2 that is placed inside ui.Image1, then I want to save the result to Texture2d to save the resulting image to png.
...
2
votes
1
answer
581
views
Find out hit child with RaycastHit
Let's assume having a (2d-) gameobject with 3 images: Head, body, feet.
By using RaycastHit2D I can find out if the gameobject was hit (for example by the mouse):
<...
1
vote
2
answers
167
views
Interaction between GUI and character(s)
This is more a question about architecture. Not sure if there's a right or wrong:
Let's assume I have some gameobjects:
GUI: A menu containing some elements like "Go to position". It's opened when ...
3
votes
1
answer
2k
views
Using unity app how to read the asset in android SDCard?
I am trying to read one file from my android sd card from my unity application, but its not reading.
using the asset bundle i have exported my file and kept in my android device sd card and i am ...
0
votes
1
answer
942
views
Unity GridLayoutGroup children ignoring resizing
Can anyone explain why, in the editor I get:
while, on my Galaxy S6, I get:
My Panel UI element (which is the parent) has the ...
1
vote
1
answer
234
views
Unity 2D, do Touch event must happen in the update() function?
(Unity 5.1)
My Issue is when attaching a script to a gameObject, all the examples I've found are based with the update() function and it's pretty wierd for me, as a desktop games developer.
Is there ...
0
votes
2
answers
2k
views
How to check if an GameObject exists in Unity2D? (Javascript)
Im making an AI that checks if the player exists or not. How do I check if a certain object exists and put it in a boolean variable?
0
votes
4
answers
6k
views
How do I move an object towards a moving object?
I am trying to make an AI that tries to move towards the player but I don't know how. I tried using Vector2.MoveTowards() but it just mimics my movements instead of ...
0
votes
1
answer
1k
views
How to get a Vector2 location of an object? (Unity2D javascript)
I need to make an "AI" that makes a ball try to touch the player. But Vector2.MoveTowards()needs a Vector2 variable but how do i get the location of an object?
1
vote
1
answer
450
views
Player launches into air when hitting steep slopes
I've been debugging an issue where when my player is moving forward at high speeds (I have configurable movement modes for an overview/overwatch mode) if they are in walk mode and hit a steep slope ...
-1
votes
1
answer
604
views
Quaternion.Lerp not working properly in Unity3d
I'm using Quaternion.Lerp to rotate a joint with a certain angle, but when I use the below code I find the joint rotating very far although I specified it to rotate ...
0
votes
1
answer
537
views
Unity - Jump counter for double jump script not working? C#
It was working fine last night but it doesn't work today, the zJumpCount stays at zero after I jump now. If the zJumpcount stays ...
-1
votes
1
answer
161
views
How can I can create a world that a player can easily get lost in? [closed]
I am a 3D environmental artist and I'm currently planning an independent passion game project of mine. I have the concept of crazy hallways that lead to the rooms that the player has already visited, ...
1
vote
2
answers
7k
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 ...
0
votes
1
answer
427
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 ...
1
vote
1
answer
3k
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
2
answers
340
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 ...
0
votes
1
answer
2k
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?
1
vote
1
answer
1k
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.
-1
votes
1
answer
118
views
Error BCE0043,BCE0044 and UCE001 [closed]
I got my code right here:
...
3
votes
3
answers
5k
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
1
answer
84
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
1
answer
468
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 ...
2
votes
1
answer
342
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
1
answer
2k
views
Material not changing Unity3d [duplicate]
I have a MeshRenderer mr public variable in script1. I dragged mesh1 from the assets in the <...
0
votes
1
answer
5k
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 ...
1
vote
2
answers
821
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
2
answers
1k
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, ...
0
votes
1
answer
509
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
2
answers
5k
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.
5
votes
3
answers
2k
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
1
answer
146
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:
...