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
0 votes
2 answers
252 views

Animating object, setting isKinematic=false, and then letting physics take over

I'm trying to create a "tree felling" effect, where the tree trunk falls over after being cut down by the player. I've used one prefab which contains my tree stump and tree trunk as children. In its ...
1 vote
1 answer
48 views

Cloud based fog of war

I'm working on a Unity 3D game that requires fog of war. It is seen from above. I was looking for help and found this: (I dont know what game it is though) This would perfectly fit my needs but I don'...
0 votes
0 answers
16 views

How to get Windows identifiers in Unity?

I'm trying to get an unique computer (Windows) id in Unity. I can get it in .net Framework using this code, that I found somewhere: ...
0 votes
1 answer
23 views

Random value is chosen 2-3 times, then after that it's always 1

...
0 votes
0 answers
6 views

Unity - One client can control all player objects in a multiplayer game (Netcode and Input System)

TL;DR Clients can control only their player objects with keyboard, but all players with gamepad (using Netcode for Game Objects, Unity Input System and a PS4 Controller) I am working on a multiplayer ...
0 votes
1 answer
55 views

How to create a 2d array in Unity using Visual Scripting?

Found some good tutorials on how to create 2-dimensional arrays in Unity: https://owlcation.com/stem/Using-Single-and-Multi-Dimensional-Arrays-in-C-and-Unity3D Anyone know if this is also supported in ...
0 votes
1 answer
49 views

How can I create noises when character is running using this audio manager script?

So I used this tutorial: https://www.youtube.com/watch?v=tLyj02T51Oc, to create an AudioManager that can be easily called from other scripts, and can fade sound effects. One thing I do not know how to ...
1 vote
1 answer
57 views

Why does my collider behave strangely after a coroutine

So I'm trying to create a simple script that is going to handle the logic for cutting down a tree I'm experiencing some strange behaviour with my script. I have a private field which holds the "...
0 votes
0 answers
12 views

RayCastHit2D returning value only once, then stops

I am trying to do a check to make sure the player is not on a wall, so that he doesn't not continue jumping upwards when hitting it, as it returns him as being grounded. I am using a RayCast2D coming ...
0 votes
0 answers
13 views

line renderer collision detection in 3D

I've been using the code down below to simulate a rope physics (based on this: Create Rope Bridge, String in Unity - Verlet Integration Part 2). Currently, it uses edge collider 2d to detect collision....
4 votes
2 answers
373 views

How can I rotate the game stage?

I have a pseudo-game which I'm developing in 9:16, to be displayed in vertical screens. The client now needs another version in 16:9, rotated in 90º. I tried creating a empty object, putting all my ...
0 votes
1 answer
22 views

How to use pingpong in the waypoints script?

I tried this : And the pingPong is working but after some times changing the pingpong flag true false many times i'm getting index out of bound exception : The pingpong line that give the exception : <...
0 votes
0 answers
13 views

How to determine for every wall in a 2D tilemap where's the "inside"?

I'm working on an ARPG, and I'd like to implement a "fading walls" system similar to Diablo II's. Let's say I have this tilemap, where Black tiles are walls, Brown tiles are floors, White ...
1 vote
1 answer
88 views

Unity UI - Make text come out and go back in

In Unity UI I have a TextMeshPro Button and some TextMeshPro Text like in the following image: Is there any function in a Tween Library like DOTween that could make the text look like its coming out ...
0 votes
1 answer
25 views

Pathfinding over network and local avoidance

I'm trying to build a little MOBA game (max 10 players) in Unity and i'm really stuck with the pathfinding / local avoidance. Here is what i'm doing when user click to move on the map: Client send a ...
0 votes
0 answers
37 views

Copy a meshes pose to pose another mesh

I am making a VR project in Unity and am working on a modular character customization system. I am relatively new to Unity, so direction on how to approach this aspect of the project would be ...
0 votes
1 answer
257 views

Render texture seems to ignore camera background type

I'm currently trying to pull a fog of war for an rts game, and planned it like this. (Unity 2020.2.7, URP 10.3.1) Use units field of view to generate a texture of what is seen (alpha 0). Create other ...
0 votes
0 answers
80 views

Fully exiting HoloLens Unity apps, including closing the window

On both the HoloLens 1 and 2, with Unity at least from 2019.x LTS through 2020.x LTS, with at least 2D windows/fullscreen and 3D immersive apps, with any XR plugin (or no XR at all), run-in-...
2 votes
2 answers
61 views

Applying upgrades to pickups that do different things

In my game, the player has pickups that they can activate that each do different things. Some examples include: Restore your health Gives you a one time speed boost Give you a bubble that bounces you ...
0 votes
1 answer
25 views

Passing a string as argument to Unity Job System

I have a Job that needs to take some string from main thread and use it locally. Considering that the Job System cannot directly accept the string as an argument, is there any workaround to circumvent ...
0 votes
1 answer
22 views

Is there an alternative to Update for continuously spawning an object?

What I did here works, but it looks messy and funny to me. ...
0 votes
1 answer
54 views

Action delegate always return null

I have two separate classes(Tree, Inventory), OnCollision I trigger the Interact function, in which there is an Invoke of an Action delegate event TreeCollected, it seems to always return null ...
0 votes
1 answer
44 views

Changing Ambient Light settings in Environment window does not affect scene after baking LightMap

My settings: Unity version - Unity 2021.1.12f1 Lightmap Lighting Mode - Bake indirect Render Path - URP I want to change Ambient Light in Environment window while I have baked LightMap. Is it possible?...
-1 votes
2 answers
29 views

How do I check for nulls when called an event from another script?

...
0 votes
1 answer
37 views

Preventing other animations from resetting when a new animation starts playing

I'm playing some animations through a C# script. In such script, I'm not using any other methods except GetComponent<Animation>() and ...
0 votes
1 answer
44 views

How can I scroll/animate up lines reading from a string to ui text?

This is the reading lines code : ...
0 votes
0 answers
44 views

Issue with Goal Oriented Action Planning (GOAP) and multiple preconditions

So I am working on an AI for my game using GOAP. I've been researching it for the past few days and while implementing it on my own I've ran into a problem. Here is a diagram of what I am doing. The ...
0 votes
1 answer
561 views

Mathf.Clamp not Working Properly

I want to clamp the vertical rotation of the first person controller I was making. I want to restrict the vertical rotation of the main camera between -90 and 90 degrees. The code is as follows: ...
1 vote
1 answer
392 views

Character moving without control

i've been developing a third person adventure game on Unity with a grappling hook and i found a problem that i don't understand and it's driving me mad. Basically, if the player character collides ...
0 votes
2 answers
37 views

Is it possible to project a vector on another vector to calculate the distance without raycasting

I have the following game scenario: Player is P and there are 2 enemies E1 and E2 I want to calculate the distance between the ennemies and the player base which is anywhere in that green line, and ...
0 votes
1 answer
45 views

Switching out the mesh of a game object at runtime

I am trying to switch out the mesh of a game object. I have this script: ...
0 votes
1 answer
17 views

Best practices for mirroring actions of a humanoid rig?

I'm making an action game in Unity, where the player character can hold an item in either hand, and some objects are held in both. I want the PC to be ambidextrous, so I essentially need to be able to ...
0 votes
0 answers
23 views

How to install packages from scoped registries on older versions of Unity?

I have a Unity project using v2018.2 (I cannot update it) I need a package (namely, keijiro's OscJack) which must be installed using a scoped registry Scoped registries don't seem to have been a thing ...
-1 votes
1 answer
94 views

Player light color he collects before checkpoint is getting reset when he restarts at checkpoint

I have a child object for my player called Light. The light color changes when the player touches balls of different colors. When I respawn at a checkpoint, the light is getting reset to the default ...
0 votes
1 answer
22 views

Attach images via script into array unity

I have 3 objects of Image type in game scene. So I need to attach this 3 objects via script into Image array inside of this ...
1 vote
1 answer
34 views

Centralized Event System with arbitrary number of parameters of arbitrary types

I've coded an event queue system that supports subscribing/firing events with an arbitrary number of parameters of arbitrary types. So I basically declared a delegate that accepts arbitrary parameters ...
3 votes
1 answer
626 views

How do I get an object to rotate in world space via RigidBody.AddTorque? [duplicate]

I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another ...
0 votes
1 answer
271 views

Unity update sizeDelta in OnValidate based on Layout Group computed values

I'm trying to update the sizeDelta of a RectTransform in OnValidate. I'm trying to grab the computed values from a Layout Group. Here's what I've got: ...
1 vote
2 answers
326 views

Unity Mouse position for weapon wheel

Say i have the following wheel: Now i wish to use the mouse to select weapon by movement: So If mouse is to the left it picks the Sword if mouse is at the top it selects the bow and arrow if the ...
0 votes
1 answer
66 views

How to simplify a 2D mesh with messed up topology while keeping as much of the shape as possible and as efficiently as possible?

I'm trying to figure out a way to simplify any 2D mesh during runtime in Unity with broken up topology so that it will have more uniform topology and retain as much of its original shape as possible. ...
0 votes
1 answer
19 views

How to detect long press on object using Unity EnhancedTouch?

I want to implement a feature in my mobile game where if you press on a game object for a certain amount of time while not moving your finger an animation will play. I also need to be able to drag and ...
0 votes
1 answer
33 views

How to check if finger is touching the screen using the Unity input system?

I have a While loop that runs when the mouse is pressed and it look like this: while (mouseClick.ReadValue<float>() != 0) { //Do something } This works ...
0 votes
1 answer
34 views

Why use Animator.StringToHash?

Using Animator.StringToHash, doing something like: public static readonly int MyBool = Animator.StringToHash("MyBool"); Could anyone explain why one ...
0 votes
1 answer
21 views

Unity mobile joystick input doesn't react to touch

I created a 3D mobile project, so I used my own joystick script, I also tried joystick from asset store. The problem is that the stick image of joystick doesn't move at all, in this case it's ...
0 votes
0 answers
14 views

I would like to learn Unity and i need some tips [duplicate]

I have done quite a bit of programming in C#, i would say i have a fairly good understanding of mathematics, but i am not good at graphicsdesign. Do you have any ideas for a project to start with to ...
0 votes
4 answers
765 views

Sticking the Rigidbody2D player to a moving platform without parenting & transform fiddling

I have a player entity with Rigidbody2D component and I have a moving platform which is a kinematic Rigidbody2D. Player movement is done by setting it's velocity (...
0 votes
1 answer
45 views

Clipping speed when turning without using aggressive drag

I have a Unity project in which I want to control a player in a similar way to Source games, and so far I am clipping each input to the speed in the player's coordinates, by using ...
0 votes
0 answers
17 views

Unity asking to enter Safe Mode?

I installed 2021.3.2f1 with the documentation and WebGL module and created a new project from Unity Hub. When I try opening that though I get this: Not sure why this is happening. I deleted the old ...
0 votes
0 answers
28 views

How does using C# and C++ together with Unity affect efficiency?

I'm new to game dev and I'm looking to use Unity to create a phone game that will utilize neural networking. Obviously, putting neural networks in a mobile game presents a serious performance concern, ...
0 votes
1 answer
12 views

Characters not applying avatars correctly

I am trying to get different models to go through animation cycles in Unity. The first four models are from Mixamo. Does anyone know why my characters end up like this (lodged into the ground) when I ...

1
2 3 4 5
303