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.

Filter by
Sorted by
Tagged with
0
votes
2answers
2k views

Object spawn only on Server in multiplayer unity3d game

In my game I have an object let say food, whoever eat that food that player will spawn one more element. I am sharing code here :- I am checking collision in Update. Following code is working fine on ...
0
votes
1answer
24 views

Unity Raycast works only once-Ignores NavMeshAgents

I'm new to unity and just trying to build a game. I've been trying to use Raycast to detect if an enemy is next to the player and I can't seem to get the Physics.Raycast working properly. Everything ...
0
votes
4answers
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
2answers
85 views

Jittery collisions in Unity 2D

I tried to implement a simple movement to my object. My object moves perfectly fine but I'm having issues with its collision. When I keep on moving object towards the obstacle/ground, collision are ...
5
votes
2answers
15k views

Screen record in unity3d

How to do screen record in unity? I want to record my screen(gameplay) during my running game. That should be play/stop , replay , save that recording on locally from device, open/load from my device (...
0
votes
1answer
2k views

AdMob interstitial ads not showing after publishing in playstore

I have create a Unity game, 1st I add an AdMob interstitial ads script on game object then try on my main camera when I test in my mobile before publishing. It has worked like real time ads and ...
3
votes
4answers
6k views

Unity ScreenToWorldPoint always giving same coordinates with mouse position

I have a question about Unity's ScreenToWorldPoint. Whenever I use ScreenToWorldPoint(Input.mousePosition) and display the output in console this always gives me the same coordinates. MyCode: ...
0
votes
1answer
24 views

How to add post process volume script in unity 2019?

i have old unity 2018 project and imported standard character asset. The 3d player has this script : post process volume and post process layer. In 2018 i can add this component but not in 2019 . This ...
0
votes
1answer
314 views

Using Part of prefab as script parameter

I'm trying add a weapon to Eithan - the third person character. So I want to take his hand, which is part of the prefab Eithan (the weapon location) and use it in the my Player.cs script to ...
0
votes
0answers
13 views

Prefabs scaling change also the original prefab

I want to work with a prefab as local and global variable? something like that. So my question is how to change a prefab scale without affecting the original prefab.
0
votes
0answers
28 views

Record from microphone and playback audio in the next scene in Unity

I am making a simple interactive video in which I need to trigger the microphone to start recording automatically in the beginning of the scene and stop recording after 15 seconds. And then, I need ...
0
votes
0answers
379 views

Unity3D: Create scripts to climb a ladder

I'm inexperienced and I'm trying to understand the mechanism for using a ladder with my character or climbing over small walls. To move I use a rigidbody not kinematic, but with AddForce. I tried to ...
0
votes
0answers
4 views

Why do I get a delay on a 2D Trigger collision only on Build?

I have a weird problem. When I play the game in the Editor everything seems fine. My Player has to walk into a trigger, that triggers to flickering the lights. In the Editor its happening immediately ...
0
votes
0answers
32 views

unity3D Angry bird orthographic 3d approach

i want to create a game like angry birds but in orthographic mode 3D . i want to give the player the ability to Jump to the Red and Blue Platform (see the picture below) with the Click, Drag and ...
0
votes
0answers
52 views

Why doesn't my navmesh agent stop when they are stoppingDistance away from their target?

I am testing my mesh navigation program on Unity, but I am not sure why the instance variable stoppingDistance of NavMeshAgent ...
0
votes
0answers
302 views

The ball should always move to the poles of the planet

I have a ball (player) that moves around the planet (also a ball, but of a larger size). The player must travel the planet passing circles from pole to pole. He has the ability to move left or right ...
0
votes
0answers
29 views

Enemy destruction shows particle explosion but GameObject doesn't disappear?

So I want to make an enemy that self destructs after it collides with the player, but for some reason after the enemy collides with the player, it doesn't destruct and only plays the particles. In ...
0
votes
0answers
15 views

Animation for some reason doesn't trigger after death

So I am trying to trigger this explosion animation after this enemy dies, but for some reason the animation doesn't trigger. I've made sure that the explosion animation is linked to "Any State", and ...
0
votes
1answer
73 views

How do I account for the velocity difference between a ship and it's fired projectile?

In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as ...
0
votes
1answer
29 views

Actual Sizes of An Image loaded with a Path

I have a method which selects an Image from device. I need to show this image to users. The codes below works fine, does what I need. ...
0
votes
0answers
28 views

Unity 3d Raycast from localspace to worldspace

I want a raycast direction not relative to the rotation, but what happens is that the raycast points to one place as if it was a transform.forward Why is the happening help ...
0
votes
1answer
96 views

How to attach main camera to script component of a prefab?

So I have a prefab which is an item drop and a timer attached to the main camera. When the player collides with the item, I need the item to destroy then add time to the timer. The itemdrop handling ...
4
votes
4answers
4k views

Unity: Assigning a key to perform an action in the inspector

I am trying to write a simple piece of code in JavaScript where a button toggles the activation of a shield, by dragging a prefab with ...
0
votes
1answer
43 views

How to raycast from a UI element

How do I raycast from a UI object? I have tried Ray ray; Camera cam; Transform obj; //UI object ray = cam.ViewportPointToRay(obj.position); AND ...
0
votes
1answer
166 views

Unity Bot AI behaviour

I'm working in Unity3d 2019.2.0f1 and I'm trying to make a chasing bot that follows a certain GameObject with the "Player" tag. I'm not yet attempting a field of ...
0
votes
3answers
97 views

Inheritance - accessing child class values

I want to use the same variable for five different child classes. It is basically a boolean that is true when a player purchases an item(represented by a child class) and false when the player is yet ...
0
votes
0answers
196 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
0answers
35 views

Why does my “spawnedEnemies” variable not update when enemies are destroyed?

I'm creating a shooter game and I'm trying to update the current count of enemies on screen. When the laser hits an enemy, it is supposed to subtract 1 from the "spawnedEnemies" and then destroy the ...
0
votes
2answers
148 views

Unity - change only z axis rotation to 0

I have a child where I want the rotation to work like (parentRot, parentRot, 0). So first I set its ...
0
votes
0answers
21 views

NullReferenceException: Object Reference Not Set to an Instance of an Object (How is that so and I should I solve it?) [duplicate]

I am stuck several days because of this problem, which I am almost on the verge of giving up. (Using Unity Engine 2019.3a by the way). The TextButtonName.text can't read what TextButton is throwing to ...
0
votes
2answers
100 views

Showing Frame Rate Info in the Unity scene using Custom Script failed

I want to lock the framerate of my scene to 30fps, then I learned from this post that fps info in Editor Stat isn't reliable, that's why my fps is still around 100. This is my script for setting the ...
1
vote
1answer
229 views

Problem with Rotation clamping in Unity

I'm trying to get a simple cannon to rotate to point at the mouse, but I only want it to follow the mouse for 180 degrees and then stop following the mouse, and pick up again when the player re-enters ...
3
votes
2answers
22k views

How do I change the material of an object with Script in Unity?

I was making a game with Unity and I want to change an object's material using UnityScript when the player collects 5 collectables that I made. The collectables get stored in an int variable called ...
0
votes
2answers
3k views

How to make the wheels rotate depending on the speed of the vehicle

I want to know what the right formula is, or a way to make the wheels rotate with the speed of the vehicle? What is the standard way to make wheels look realistic and natural? Do developers use other ...
1
vote
1answer
60 views

unity 3d loading data from json problem

i am trying to practice on loading data from json files my problem is about when i try to load the sprite path from the json file to load the image icon from the floder that contain it, i manged to do ...
0
votes
1answer
45 views

how to reset etsa function GetJoystickNames in unity?

the problem is that if I connect a command the array GetJoystickNames increases an index but if you disconnect it does not reduce the index and continues counting as if it were connected
0
votes
0answers
25 views

Make players Rigibody move in direction its going?

I have my snowboard character which I am trying to fix the movement for. At the moment, The player is using transform.forward on the rigidbody to move forward. If my player turns around and faces up ...
0
votes
0answers
41 views

How can I deactivate and activate a button?

I have a code that keeps a gameObject between scenes, the theme is that this gameObjecte has as a child a button, which I can change the linerenderer color, besides changing the image of the button ...
0
votes
0answers
9 views

Issues with Flashlight Handle position with player rotation

I want the flashlight to look same while looking up and down as when looking straight. Normal Position for Hand and flashlight: Looking up and down, position is completely off: More images for ...
0
votes
2answers
737 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 : ...
3
votes
1answer
518 views

Unity3d UnityWebRequest EscapeURL standard does not match Swift url encoding. How to decode it?

How should I decode escaped URL by unity in Swift? I am developing a game with Unity3d. Something MMORPG. With server implemented by me in Swift under ...
1
vote
0answers
26 views

Scene for Computer Screen

We are developing a scene that will involve heavily interacting with a "touch screen monitor" in the scene.. Because the workflow of the touch screen will need to be dynamic we are creating a REST API ...
0
votes
0answers
50 views

How to make mobile movement using CharacterController

How can i change my movement for mobile i think left and right gonna work but i don't know what should i do for jump ...
0
votes
0answers
20 views

NullReferenceException until tile is spawned [duplicate]

I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script ...
0
votes
1answer
102 views

why is GetComponent<ICameraControl> returning null?

As you can see in the attached image below and the code, I have added a class that implements the interface ICameraControl attached to a ...
1
vote
0answers
32 views

Discrete line inside a 3D matrix

First of all a little premise: I'm following this tutorial on YouTube for procedural 2d cave generation in unity using cellular automata and I'm extending it in order to make caves in all three ...
0
votes
0answers
189 views

Unity Erase Image from mouse pointer

I want to erase the image for mouse pointer in unity. My pointer should be as a eraser. What is I do create the eraser? My sprite is always change because it provide from the server. Please help me.
0
votes
1answer
95 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#: ...
1
vote
1answer
1k views

Custom shadow mapping in Unity. Works with preservative Light view but not with Orthographic

So about a week ago I decided to make my own shadow mapping technique in Unity based on my understanding of the whole thing. The entire experience was somewhat successful. I learned a lot and I get to ...
0
votes
1answer
208 views

360 degree Shooting using Pythagoras problem Unity 2D C#

I have used pythagoras to give the bullet a velocity in the bullet class. Velocity is applied when Instantiated(); ...

1
2 3 4 5
7