All Questions
Tagged with unityscript unity
294 questions
0
votes
1
answer
346
views
Understanding transform.forward vs. Converting World Space Forward to Local Space for Ray Drawing
I'm working in Unity and trying to visualize the forward direction of a GameObject. I came across two approaches:
Using transform.forward:
...
-1
votes
1
answer
64
views
MonoBehaviour Wouldn't Work [duplicate]
I was writing the character controller for my player character, but Unity said that there was no mono behavior script in the file I'd written the file right and I included the mono behavior ...
0
votes
0
answers
171
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
1
answer
242
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
1
answer
273
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
0
answers
205
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
1
answer
835
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 ...
0
votes
1
answer
2k
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
1
answer
398
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
3
answers
2k
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
0
answers
39
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
2
answers
2k
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
0
answers
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 ...
1
vote
1
answer
1k
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 ...
1
vote
1
answer
395
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 ...