Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
1
vote
5answers
7k views

How How can I make a simple combo combat system in Unity

I'v been trying to make a melee combo combat system in the Unity Animator, but I can't seem to get it right. I'm trying to go for a combo system that flows from Hit 1 to Hit 2 to Hit 3, ect, with ...
-1
votes
2answers
14 views

Translate transform and RigidBody2d Addforce relative to world space

I'm developing a game with my friends from University. Currently, I'm in the process of creating a basic movement system for the main player with a box form as its mesh. I used transform.Translate to ...
0
votes
0answers
12 views

How can I plug a Unity application into native Android and native iOS?

There are a lot of questions about running native Android and iOS code in Unity. I am trying to run Unity inside of native Android and native iOS apps. My problem is that I have two native apps, and ...
1
vote
3answers
35 views

Why moving platform script is not working?

I have some code attached to a moving platform: ...
0
votes
0answers
11 views

Preventing animated model from passing thru walls

I have a character model that has a sword swing animation where with every swing the character takes 1 step forward. This model has a sphere collider and a kinematic rigidbody and use a SphereCast to ...
4
votes
1answer
2k views

What type of Collider should I add to a LineRenderer?

I am currently building a game where I need to generate some wires (as Bézier curves) using LineRenderer. After changing the width of each line ...
0
votes
0answers
9 views

How to add Collider to a Line Renderer in unity? [duplicate]

I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this. Current Code ...
0
votes
2answers
2k views

Unity - How to get nicer shadows from distant point lights?

I get too unsatisfying results for shadows when using a point light that is far away. (The quality settings are maxed.) The scene: The result: The light: What can I do to get better shadows?
0
votes
1answer
12 views

How do i implement a banner ad from mopub in my android unity app

I am new with unity and everything and I have made a simple game. I wanted to put a mopub banner ad on the game and i read this on their site. But I was wondering where should I put that code from the ...
0
votes
1answer
19 views

Why boxCollider bound extents change when changing the size of an gameObject but doesnt in the script?

So, I have two players when I first made them they were with the default size Y = 1. After I finished the scripts I wanted to change their size but when I did that, ...
0
votes
1answer
40 views

How to activate a button?

Develop a timer script, the idea of this script is that after an amount of time has passed, a button that I have in the scene is activated, this script also uses this script uses DontDestroyOnLoad, ...
7
votes
4answers
4k views

Can I use two Collision Boxes on the same GameObject?

I have two Collision Boxes on the same GameObject. I don't want the Collision Boxes to be triggers. I want the Collision Boxes on the actual GameObject, not its children. For example, if I want to ...
0
votes
0answers
46 views

Unity3D - Camera Shakes When Displacing and Rotating Smoothly

DISCLAIMER: I am using Unity 5.6.5f1 for this code, I honestly don't know if there would be API updates on later versions, though I don't think so. I tried to make a simple Third Person Camera that ...
0
votes
1answer
219 views

Help with 3D Double Jumping in Unity

I'm having some trouble with vertical movement. I'm trying to add double-jumping but none of the scenarios online seem to be working, and I can only ever manage to get a single jump. Here's my code: <...
0
votes
1answer
1k views

How do I integrate Nvidia Ansel into my Unity game?

I want to be able to use the super high resolution image capabilities that ansel have to offer but I don't know how to add it as the only thing that i can find are C++ libraries on their website.
0
votes
2answers
60 views

Using enums for detecting object collisions

As far as I know, I can detect what objects the player is colliding with is by the following code: ...
0
votes
1answer
16 views

Unexpected scaling of UI elements after build [Unity Web]

I have an unusual scaling of UI Elements after my build in unity for WebGL Game in Unity Engine: Game in Itch.io: Has anyone seen this kind of behaviour? any suggestions on what I should look into? ...
2
votes
3answers
5k views

What physics settings do I need to apply to make the pool game realistic?

I want to create a pool game using Unity. I added the spheres as playballs and cubes as the walls. I added a rigidbody to all objects and Im able to do some basic collisions like in a pool game. My ...
1
vote
1answer
51 views

Adding a feedback survey to a game

So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would ...
0
votes
1answer
18 views

Unity 3D move kinematic rigidbody

I'm trying to move a kinematic rigidbody (a spaceship) with this code: ...
-1
votes
1answer
37 views

change color to rgb in c# unity

So I am trying to change my color of my sprite to a rgb color. Now I can just change it to a color like red, black or blue... m_spriteRenderer.color = Color.blue; ...
0
votes
1answer
33 views

How to make a follower script without diagonal movement

I’m working on a 2d game in unity. Right now I’m trying to make a follow ai. Where a character will follow the position of the player. I currently have it set it and working using the MoveTowards ...
0
votes
2answers
171 views
+50

Creating 3D water on Unity for iOS/Android

I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling ...
0
votes
1answer
36 views

Reading text from file changes the text?

I'm currently trying to load a simple text file and filter it by a certain string. In the text file I'm using a new line for each value and sometimes use a "--" to make things easier to read for me ...
1
vote
1answer
35 views

How to validate that certain fields are nonempty before the program starts?

I want to check that some fields are nonempty before any of the Start() functions run. I tried to put checks in Awake() and <...
0
votes
0answers
31 views

What would be a good way to render individual meshes for a Tetris-like game in Unity?

I've been thinking of making a Tetris-like game in Unity3D, and I've looked at a few options to render several amounts of blocks in a matrix. I want to use the classic iterate-through-all-items-in-the-...
0
votes
2answers
34 views

Unity - Access animation clips/motion of an animator

So I have an animator on my GameObject. I need to change the animation clip/motion of different states in my animator to the one I assign in my EditorGUILayout.ObjectField. Problem is, I have no idea ...
2
votes
2answers
62 views

Programming logic to 2D point and click adventure/puzzle?

So I am totally new to game development . I wanted to create a 2D Puzzle/Adventure point and click game similar to like Rooms but scenes are connected. I have already done the inventory system but ...
0
votes
0answers
14 views

Object not clamping after applying force/impulse?

I am having issue with clamping the vertical position of my character after applying force. This causes a jittery effect in my character. There are other several ways I think of, but I dont know if ...
0
votes
1answer
37 views

How to handle forward/backward movement in an oblique top-down view

I'm making a pseudo-2D top-down game, where my assets are actually 3d but I use an orthographic projection to introduce more depth. I saw a picture of how the game "Enter the Gungeon" was actually ...
0
votes
2answers
50 views

How to access the parent of a cloned prefab?

I have a menu that gets populated at runtime with buttons whose text components are based on objects that the game manager has in its databases. At the start, the menu is empty: See that "A" graphic? ...
0
votes
0answers
8 views

Unity - Black lightprobe after bake

What does it mean when a light probe looks like this after a bake? And why does it happen? It not touching anything, and all the others are fine.
1
vote
0answers
13 views

Setting up Lightprobes

Moving around lightprobes requires using the movetool and all you really can do is move them along global axes and copy paste. There are no functions to scale, rotate, Snap to a surface, not even ...
1
vote
1answer
39 views

How to mirror a vector through some other vector?

I have a player's direction (playerDirection). I want to fire two bullets, one rotated by -30f, and one by 30f, so it looks like this: Blue line is the ...
0
votes
1answer
2k views

Using ShaderGraph for UI elements with transparency

I am trying to design some UI elements using shader graph. In this case specifically a lifebar that is transparent where empty. For a normal lifebar with a filled and empty color I got it working ...
0
votes
1answer
21 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 ...
1
vote
2answers
1k views

Hold touch at the screen to move object

I'm using unity2D and C#, and I have a code for touch screen: ...
0
votes
1answer
57 views

How do I use this Perlin Noise texture to change the mesh?

Using the Unity docs page on Perlin noise, I made this script: ...
0
votes
1answer
57 views

Draw a line along one continuous edge of a curved mesh

I have a rectangular mesh, but the mesh is curved: I want to draw a line along one side of this curvy mesh. Currently I can easily draw line along a side of a flat rectangular mesh by getting the ...
0
votes
2answers
2k views

Diagonal movement is faster than horizontal or vertical movement (unity)

When using Horizontal or Vertical input keys, the the movement is normal. But when trying to move diagonal, multiple keys are to be pressed, and the speed just stacks up. Yes there are many answers ...
0
votes
1answer
33 views

Get rotation of camera in Google VR

I'm trying to move child of camera object smooth. To implement that, I need to know the movement of x and y axis, like Input.GetAxis in general PC platforms. I saw the documentation and examples of ...
0
votes
1answer
91 views

Resize game object using single drag handle using Unity

Really need your help. I'm trying to create a custom controller for my app to allow users to resize and rotate game objects using a single drag object. I was able to create the code to create the ...
0
votes
1answer
43 views

Second input not working when using 2 virtual joysticks

We are trying to make 2 virtual joysticks for both sides of the screen. Movement joystick can be enabled at any pressed position of the left side of the screen and shooting joystick can be enabled on ...
1
vote
0answers
29 views

Blurry background sprite, other sprites fine

Why is the background blurry, but all the other sprites fine? The background sprite has the same settings as the others. It's on the same Z position (0). It happened after I made some changes to the ...
0
votes
1answer
24 views

Unity3D short joystick controller script acting weird

So basically there's a joystick and when the user pull the joystick up the controller moves the player forward, to the sides and backward and it's all good. the problem I'm having for example is when ...
0
votes
2answers
28 views

Unity - Save/load in a sandbox game, how to instantiate saved objects

I have a game where a player can place GameObjects. I can save/load this GameObjects data with using JSON, for example its position, but I cannot think of a good way to tell my save-file (and my ...
0
votes
1answer
12 views

Unity - Apply different Near/Far clip plane value for different layer

I am Lerping the Near value of my camera, from 0 to 38, and it give this result: change near clip plane effect As you see, it give a nice effect. But Now I would like the effect to occur only for one ...
0
votes
1answer
18 views

Repeated nested game objects (UnityEngine.GameObject.gameObject)

I created a UnityEngine.GameObject and inspect its properties while in debug mode. GameObject obj = new GameObject(); When I ...
0
votes
1answer
28 views

Move a ball horizontally left and right but restricting forwards and backwards motion unity 2d

I am trying to develop an endless runner where there is a sphere as the player and it is moving left and right following the position of a finger on a touch screen. However, when I try to do this I ...
1
vote
1answer
58 views

Overriding the sprites in a Animation clip

Right now we are in the process of adding seasonal content to our game. I would like to know of a way to override animation clips. Specifically I want to change the sprites being show at each key-...