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
2
votes
1
answer
2k
views
Difference between Unity's Camera.ScreenPointToRay and Camera.ScreenToWorldPoint?
What is the difference between Unity's Camera.ScreenPointToRay and Camera.ScreenToWorldPoint. And where we can use these. I've ...
0
votes
1
answer
2k
views
Unity navmeshagent and doors
I'm trying to make an agent patrol around a maze. The maze is proceduraly generated and consists of many rooms connected with doors. The problem occurs when the agent reaches a door. I wrote a script ...
0
votes
1
answer
2k
views
0
votes
2
answers
937
views
MonoBehavior Script that uses UnityEditor - Best practice for Location?
I've created a script which helps me auto-generate a GameObject prefab. It uses some UnityEditor, so it can't be used at runtime ...
1
vote
0
answers
1k
views
Save Generated GameObject as Prefab
I've written a script which will automatically generate a Mesh, assign a MeshFilter, MeshRenderer, BoxCollider, and RigidBody.
This script is meant as a tool to rapidly create a certain class of ...
2
votes
2
answers
4k
views
is GameObject.Find() a bad idea even for one frame?
as I searched GameObject.Find and GameObject.FindwithTag are heavy to work with and for reall projects its better to find ...
1
vote
1
answer
932
views
Object pooling with collisions in Unity
I am trying to create doodle jump like game with object pool for platforms. I have created an empty object with box 2D collider attached to it. This object moves with player and should be gathering ...
2
votes
1
answer
6k
views
Unity RectTransformUtility.ScreenPointToLocalPointInRectangle
What does the unity's RectTransformUtility.ScreenPointToLocalPointInRectangle do
I've read unity documentation but I didn't get the clear meaning.
0
votes
1
answer
189
views
Changing coordinates of the object with velocity preservation
In Doodle jump, if a player jumps over one side of the screen he appears on another side with preserved velocity and other physical parameters.
I made two trigger colliders on the sides of the screen ...
0
votes
0
answers
225
views
Unity Photon multiplayer :: check distance between two players
How to get distance between two player in a photon multiplayer game. Condition is both the player is moving.
I have tried something like this, in my player control script:
...
0
votes
0
answers
113
views
Capture Video without Third Party SDK's
I am trying to capture the game play and store it on local memory without using any third party sdk's. I tried This Video Capture Script but i didn't get the recorded file even i don't know whether it'...
1
vote
0
answers
175
views
Gyro and swipe in Unity
How can I properly save rotation of the camera while swipe and pass it to transform.rotation = Quaternion.Slerp() start start Quaternion?Right now after I swiped Gyro get his transform.position and I ...
0
votes
1
answer
90
views
Unity Player Movement Script nullifies gravity
i want my Player to be affected by gravity, while being able to be moved in horizontal direction(the Player jumps up and down), but my script:
...
1
vote
1
answer
156
views
Unity Player Movement Problem
I want to make a little game in Unity, where the player (a ball) jumps up and down and you have to maneuver it through (flappy bird like) obstacles.
My problem is, after I added a simple movement ...
0
votes
1
answer
141
views
Dynamically Changing GameObject makes NullReferenceException(C# Unity)
Here's my code
...
0
votes
1
answer
124
views
How can I attach a ball to something? [duplicate]
I'm using Unity 2017 and am writing a game wherein you shoot a ball, and when said ball hit something (a cube for example), I want it to remain in that position that it hit.
I tried this but it didn'...
0
votes
1
answer
119
views
0
votes
0
answers
173
views
Why when creating lines using LineRenderer it's creating too much objects?
Since I'm drawing a box it should have 12 lines but when running the game there are 24 objects. 12 are the lines but the other 12 seems to be doing nothing.
...
0
votes
2
answers
182
views
0
votes
1
answer
170
views
C# invoke stops unity
I'm making a game where in needs to randomly generate objects on a plane, so I setup a code to spawn Food, but whenever I run the code Unity uses up all my computers memory and 40% cpu. I have a ...
0
votes
2
answers
59
views
how to modify multiples BoxCollider on a same game object?
I have an game object with multiples BoxCollider attached to it, is there a way to get all the BoxCollider to an array so that I could modify their value individually ?
1
vote
0
answers
553
views
Unity3D: How to play 360 video without VR mode?
i followed the official Unity tutorial to make an inverted sphere and play a 360 video inside it and i managed to do it but the problem is i can't build the project to my phone because it says i have ...
-2
votes
1
answer
140
views
How can I select a sequence of objects by moving mouse in Unity?
I have a board of tiles in my game in Unity and I have to select a sequence of tiles by moving the pressed mouse over the tiles like if I would select letters in a such game like on the screenshot. ...
0
votes
1
answer
585
views
How can i access animation from animator in unity3D
I want to perform some specific functionalities if my character is in Idle state and IdleUnarmed animation is playing and !anyKeyDown. I do not know how to access that "IdleUnarmed" animation from ...
2
votes
2
answers
427
views
How can I make car respawn with temporary invulnerability i.e. no collisions?
I'm using Unity's standard assets scripts to move my car, but the camera just follows the road.
At certain moments when the car misses or overturns the player can press 'R' to reposition the car in ...
0
votes
1
answer
45
views
How to always land a square box in 90 degree
How can i Always Land a box in 90 degree
Here What i want
Here what i don't want
...
-1
votes
1
answer
171
views
How to throw sprites at random direction in unity
I have 2 Questions;
1.How do i throw square in different directions on every click while maintaining cyan border restriction
2.How to keep rotating square after i click in z-axis
Check This Video ...
1
vote
1
answer
2k
views
Unity target position never stops with Vector3.SmoothDamp
I've integrated Vector3.SmoothDamp method to have a more fluid and native movement between the character and his camera in Unity. The camera movement is perfectly ...
2
votes
1
answer
726
views
UnityEvent Array coding C#
I am fairly new to Unity 5, as I was browsing through some prefabs, I found one for the Main menu in which UnityEvent was used in scripts to list down the menu options.
This UnityEvent was an array ...
1
vote
1
answer
201
views
Converting UnityScript code to C#: What is the alternative for .ToBuiltin?
I'm trying to convert this code from UnityScript (Unity's version of JavaScript) to C#:
...
0
votes
2
answers
61
views
Unity Animation trouble
I am trying to make an animtion for my Sword so that when I click with my left mouse button, the sword gets swung. I watched a tutorial video and tried to follow all the steps but whats happening is ...
0
votes
0
answers
116
views
if the player moves in the real world the game object also want to move
I am creating an iOS game. It's my first experience in iOS. I am facing an issue in player movement. If the player moves in the real world this means the game object (character in the game) also wants ...
0
votes
1
answer
2k
views
How to change the virtual joystick Input direction depending on camera rotation so the player moves to its current forward direction?
I have a scene set up where the player moves and rotates with Virtual Joystick Input. I have button which rotates the camera to the back of my player at that point I want to change the joystick input ...
0
votes
1
answer
602
views
How can i press the key, show the text and choose if i want to take the item?
It's working fine right now, showing the text and then press the key and it takes the item but, i want something like resident evil, the text is not showing until you press acction button. How can i ...
3
votes
1
answer
4k
views
Import Unity Package Into Specific Folder
Everytime i do import custom unity package file, I alwasy get Messy Folder and files in root of Asset Folder.
Any Idea how to solve this ?
Many Thanks in advance.....
2
votes
1
answer
128
views
Error once unity got updated to 2017.1
I am working on a 2D platformer and I decided to update unity to the lastest version. Everything went well but once I got the project updated I got 2 error that I am not sure how to fix. Some help ...
5
votes
2
answers
14k
views
How to implement jump in NavMesh?
I want my NavMeshAgent to jump when Space key is hit.
The Script (in Unityscript) I tried is :
...
1
vote
0
answers
90
views
Unity-Error within Tree Editor
I've been making a tree in with the Tree Editor in Unity, and for a realistic effect, I need to make all the leaves face a general direction, the problem is that most of them don't face that direction ...
0
votes
1
answer
55
views
Errors when calling functions from File class?
When I try something like File.Delete("Assets/a.txt"); it gives me a error saying
Unknown identifier: 'File'.
In Unity Documentation https://docs.unity3d.com/...
0
votes
1
answer
3k
views
1
vote
0
answers
85
views
Problems exporting animations to Unity 5
I've finished a model in SpeedTree Cinema v7.1.1 and the model exports correctly, but I can't figure out how to export the wind animation to Unity 5. The only problem is that the wind animation itself ...
5
votes
1
answer
838
views
Optimizing data structure for my text adventure? [duplicate]
In my text adventure I'm making, I store the story data in a hashtable (I'm using unity's javascript/unity script since I'm more comfortable with the syntax than C#).
The problem is, the way I ...
1
vote
2
answers
3k
views
Variable value in inspector is not updating automatically?
Something weird is happening when I change a variable value in script and hit play the var value doesn't update I have to reset the script in inspector. Is this normal? Aren't the values suppose to ...
20
votes
2
answers
7k
views
Unity Method count exceed the limit of 64K
I just got an issue related to a 64k method in Unity so that's why I'm unable to build my project. It shows method limitation exceed the limit of 64k method count. So can anyone here help me out to ...
0
votes
1
answer
226
views
0
votes
1
answer
131
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 ...
-1
votes
1
answer
1k
views
4
votes
3
answers
5k
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 ...
1
vote
0
answers
679
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 ...
7
votes
1
answer
2k
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)...