Questions tagged [unity]

Unity is a cross-platform game creation system that focuses on easy art pipeline process. It consists of a game engine and an integrated development environment. The game engine's scripting is built on Mono.

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

Make camera follow and rotate with player without childing it

I want to have a camera, that follow the player, without childing it to the player object. So far I have this one line, that follows the player, but does not rotate with it (meaning the camera should ...
1
vote
1answer
916 views

Unity 2d Animation from spritesheet: How can I move the character according to the animation?

I am trying to implement an attack animation that should end up in moving the player by some distance. The animation would be something like this: As you can see the position of the player should ...
1
vote
1answer
1k views

Unity3d select empty gameobjects in scene

I have a pathing system that I am creating in Unity. When you add nodes to denote the path, I create a empty GameObject and render it in OnGUI as a square. The problem that I have is clicking on the ...
1
vote
1answer
4k views

Unity JSON parsing Array of Objects problem - error: JSON must represent an object type

I'm trying to use Json to hold game dialog in a text asset file. I've tried to make a barebones project to test this and it is failing with the Error Message: ArgumentException: JSON must represent an ...
1
vote
2answers
5k views

Move rigidbody using WASD keys but rotate it based on camera/mouse movement

I am very new to unity and my scripts are based on some scripts found on the web. I want to make a first person view so the camera is attached to my rigidbodys head. Then i want to move my rigidbody ...
1
vote
1answer
693 views

how to get if a rotation/position has been completed?

I've done an if / else with the final position / rotation plus they never complete, how can I check this? stays like this https://i.imgur.com/3cQ9AEk.gif ...
1
vote
1answer
688 views

Where to store in app purchase data?

I'm making a game using unity. In the game I've a purchasable product "remove ads". Where should I store user purchase data? If I use player prefs data will restore after a reset or uninstall.
1
vote
1answer
103 views

How to move points of a multi-segmented bezier curve to one side

I am trying to move points from a multi-segmented bezier curve to one end of the curve using the following code which modified for my use from here. Only the last segment seems to give the desired ...
1
vote
2answers
4k views

How can I make a character crouch?

I tried to make a crouch system. In my script I changed .height and .center properties of collider in ...
1
vote
1answer
905 views

Unity: cg fragment shader processing array of points

I need to write a fragment shader which would somehow be aware of N points that are in the scene and darken pixels based on their world coord distance to the points. I'm looking for a method that ...
1
vote
1answer
115 views

Should I use a database to store ~10 000 names in a sports game?

I'm working on a single player sports game for a year or so and this doubt came up: how should I treat/store big amounts of data, like player names. Let's take an arbitrary number as example: 10000 ...
1
vote
3answers
669 views

How to rotate within a fixed interval in Unity?

I have very recently started to learn Unity. I'm trying to write code that will make a character swing a flag. I want to use this object and rotate the arm up and down. So I need to make it rotate up ...
1
vote
1answer
91 views

Method causes OutOfMemory error

If a GameObject in my game has a special ability it triggers it, but I want all the special GameObjects that this GameObject affects to also trigger their abilities, for example if a bomb hits some ...
1
vote
1answer
810 views

OverlapBox() dimensions are huge but are fine when tested in isolation

To be completely transparent, I more-or-less copied this question from the Unity forums since I did not get a reply. I'm creating this system where I'm placing level chunks together and I need to ...
1
vote
1answer
3k views

How do I disable fog on specific camera/s

I'm building an FPS with fog and I want to include a dynamic minimap, showing the locations of player and enemies in real time. This is utilized by a second camera which is orthographic and looks at ...
1
vote
1answer
225 views

How do I set up a bullet to fire towards the mouse pointer?

I am making an FPS, in Unity. I have a player with a gun, and I have a bullet prefab. I changed the mouse pointer to look like a crosshair, but I don't know how to place the bullet where the crosshair ...
0
votes
1answer
107 views

How to place a camera so that it always fits a plane?

I have a plane that can get its scale changed during the game, and I want to make the camera view it completely every time the plane has its scale changed. The only camera is set to perspective ...
0
votes
2answers
148 views

Rotating towards a target in top-down 2D game

I use the following code to rotate a transform towards another. And it's working fine. However, I want to lerp it over time period. ...
0
votes
1answer
540 views

Best way to save game data in Unity

I am currently developing a game in unity and I want to add some sort of saving system that saves the following: Locked / unlocked level. The amount of money the player has. Items / perks that the ...
0
votes
1answer
2k views

How to make a proper release build - Unity Android - x86, ARM32, ARM64

I'm trying to create a release on Google Play. I currently have Build App Bundle checked in the build settings, and it helps decrease the build size. In player ...
0
votes
1answer
10k views

How can I make my player move in the direction the camera faces?

I have a 3rd person camera which can rotate around the player. My problem is that wherever camera is facing, players forward is always the same direction. For example when camera is facing the right ...
0
votes
1answer
70 views

Interactive texture modification (such as swirling) in Unity

I am working on a game where I want to allow users to mix multiple colors (similar to shown in this video): https://youtu.be/11UFYyv8hjs?t=316. I have the following questions: I am expecting that ...
0
votes
0answers
175 views

How can I create a "rain drops on camera lense" effect with the HDRP?

I did follow this tutorial https://www.youtube.com/watch?v=OG7zyogrUTs&t=115s but I did not made it cause I am using HDRP and they are not using HDRP so the problem is I can't use the normal ...
0
votes
1answer
478 views

Unity toggleable shader property misbehaves when set by code?

I've added a toggle to my shader: [Toggle(ENABLE_COLOR_BLEND)] _EnableColorBlend ("Enable Color Blend", Int) = 0 In the Subshader: ...
0
votes
0answers
26 views

Why the character new position is not on the second teleporter but near a door?

If the two teleporters are in the same room it will teleport the character fine from the firsdt teleporter to the second. but when I moved the second teleporter the green one to another place in my ...
0
votes
1answer
506 views

Draw animating grid with terrain deformation and variable colors

I'm trying to draw a grid around the cursor that represents buildable area. this cursor grid, aligns to the global grid. all building placements must be on the grid and so this visual queue must aid ...
0
votes
2answers
654 views

the countdown timer inside while loop not working [duplicate]

i am instantiating prefab cars ... the clones had a random countdown timer with each one off them and its working very well but the its not decreasing its not counting down the timer is inside the ...
0
votes
2answers
889 views

Limit position rigidbody

How can I limit the position of a rigidbody, between two values ​​if I use this code: ...
0
votes
1answer
404 views

Mouse movement with deltaTime?

Is it good idea to multiply Mouse movement by Time.deltaTime? float mouseX = Input.GetAxis("Mouse X") * lookSens * Time.deltaTime; Should we use deltaTime with ...
0
votes
1answer
981 views

what is use of ScriptableSingleton in Unity?

in unity 2020.x Unity just has introduced scriptable Singleton. a class that derives from Generic Class Called ScriptableSingleton its like singleton but you only ...
0
votes
1answer
2k views

SVG textures for 3D game objects in Unity?

Is there a way to make textures using vector graphics and use it for 3d models so that textures would be object size independent and won't get blurry?
0
votes
2answers
1k views

How do I make my character jump in any angle?

My character is a square which can spin in any angle but it can not jump in certain angle. Can anyone help? ...
0
votes
1answer
240 views

How do I make my character jump in every direction?

My character can only jump when he is grounded, but he can only grounded in one direction I want him to jump in every direction, can anyone help? CAN JUMP : CAN'T JUMP : Code: ...
0
votes
2answers
719 views

Move GameObject with defined lists of position and rotation

I'm working on playing a replay on every strike. For that I'm recording the positions and rotation of the sphere in the list individually. I now have the values reside in the list. How do i move my ...
0
votes
1answer
159 views

How to Store Design Data in Unity including Formulas?

My team is switching to Unity 3D for an upcoming project. I'm tasked with converting our game data system into Unity. Our existing games use spreadsheet documents (Google Docs) for designers to set ...
0
votes
1answer
2k views

Architecture of "doodle jump" type gameplay infinite looping background

I am planning make a doodle jump type game, character jumping on platforms. A scrolling or doodle jump like background which ll appear to move when character moves upward and appear moving (just like ...
0
votes
3answers
5k views

Using Unity's `transform.translate()` to translate relative to an object but only using two axis

I'm using transform.translate() to move an object around the world space, relative to the camera that is following it. The camera has an angle of 23 degrees on the ...
0
votes
1answer
38 views

How to rotate the transform only on the Y?

...
0
votes
2answers
947 views

Best way to create a Chromadepth shader for unity?

I'm trying to create a chromadepth environment in unity3D. So the camera sees close objects colored as red, and then farthest objects as blue. And everything in between falls down the color spectrum (...
0
votes
1answer
2k views

FB.Init() is not accepting in my c# Script

I am trying to connect fb with my game. its first time i am connecting fb with game. i downloaded fb SDk 7.3.0 and i am using unity 5.2.1f1. i imported the sdk in my game asset. then i created a new ...
0
votes
1answer
239 views

Unity2D - Horizontal Scaling to Support Various Aspect Ratios?

I am trying to work out how to support various resolutions for my Android game. I have come up with a solution, but do not know how to implement it. Automatically, I am told that Unity vertically ...
0
votes
2answers
4k views

Projectile Direction Unity

I want to shoot a projectile in the direction the gun is facing. With my current script it only shoots vertically. (I can also make it go horizontally but that's it). This is my ...
0
votes
3answers
4k views

Unity c#: Interface object never equals null

I've created an interface class for some mechanic I'm using to interact with things in my game. Now, I noticed that checking if that value is null never returns true. Here's a screenshot of where this ...
0
votes
1answer
580 views

Unity OnCollision() not working

Seem to have exhausted google looking for an answer to a VERY bullet simple code that should work. ...
0
votes
2answers
304 views

Is it more efficient to add scripts to each GameObject or to a single parent object?

Does a C# script added to a parent object work more efficiently and effectively (in terms of both memory and performance) on all objects, in my case lighting, or adding script components to each ...
0
votes
1answer
454 views

How can I attract & repel the mouse cursor from particular UI controls?

This question came from some of my students. I wanted to share it here so others can find & improve on the solutions we've found so far. In particular, my answer below doesn't behave as well as I'...
0
votes
2answers
1k views

Why is Vector3.MoveTowards only working on a single frame?

I have three laptops in my scene and I am trying to bring them to front when I click on them. I am able to recognize which laptop is clicked by using the code below, but it doesn't move to the focus ...
0
votes
1answer
3k views

Unity Performance: How many Materials per Object?

I have learned that a Mesh with 4 Materials each 1024x1024 in Size is somewhat slower than a Mesh with 1 Material 2048x2048 in Size? In my usual workflow I tend to seperate different Materials into ...
0
votes
1answer
525 views

Unity can't add script component

I keep getting the following error when i try to drag and drop a script to my gameobject: I have made sure that both my Script name and the class name is : Soldier ...
0
votes
1answer
182 views

Item counter unity

How is it possible that a create an item counter in unity? My current Scripts - Counter.cs ...

1
3 4
5
6 7
18