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
1 answer
85 views

NullReferenceException when object is not null

So in the following code: ...
0 votes
1 answer
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 ...
1 vote
2 answers
433 views

Unity Spline Animate reset the position when change the speed

I am exploring the Unity Spline package, and within the package, there is a sample scene called 'splineAnimate' where the SplineAnimate script is used to move an object along a spline. The script has ...
0 votes
1 answer
37 views

Getting smallest possible build filesize on Win build (other than optimizing assets)

Disclaimer: I'm currently just exploring techniques and trying to save literal kilobytes just to see if I can. Please don't give me speeches about how development time is not worth it. So I got a bit ...
0 votes
1 answer
53 views

Building Android .aab from Unity

I have a VR game developed in Unity for Oculus and I want to create an Android App Bundle to upload it to the play store as a mobile game too. When I go into build I select this options: And here is ...
0 votes
0 answers
32 views

How to begin my game dev journey after learning C++ [closed]

I have soon finished to learn basics of C++ (from LearnCPP tutorial serie), pretty beginner at it but I don't feel "too lost" while programming small code snippets to practice. Biggest ...
0 votes
0 answers
48 views

Can layermask be made for colliders in Unity? [closed]

I use collider to import a few objects in Unity. And these are triggers. Actually, what I want is, for example, there is a wall in front of me and a key behind it, and I cannot get it from in front of ...
0 votes
1 answer
30 views

NavMesh Runtime Generation In Specific Areas

Unity allows the runtime generation of NavMesh surfaces with the Unity.AI.Navigation package through the BuildNavMesh method. However, this function re-bakes the entire NavMesh in the current scene, ...
0 votes
1 answer
987 views

How to instantiate a child object in UNet without it lagging behind its parent over the network?

When I use NetworkServer.Spawn(ob) t instantiate a game object and make it a child of a transform.parent after it spawns on both ...
1 vote
0 answers
49 views

Can you append values to an appendbuffer and then immediately read from that same buffer?

I am looking to achieve the following: I have a compute shader that receives a Texture2D as input, where a small percentage of the pixels in the texture are white. ...
0 votes
1 answer
41 views

Why is my enemy in unity 2d not moving?

So I'm trying to make a 2d unity platform game for a school project but I can't seem to get the enemy to move. can anyone help? much appreciated!
2 votes
1 answer
465 views

Trouble GamePad input on iOS but works perfect on Android

I am having trouble getting input from on iOS devices (iPhone 6 Plus and iPad). Here is my code, ...
0 votes
0 answers
10 views

Is it possible to prevent a graphic raycaster blocking 2D rays in different layers, from a different camera?

I have a graphic raycaster attached to a canvas, with the blocking layer set to exclude all layers except "UI": ...
1 vote
1 answer
68 views

2D Sprite components causing text (TextMeshPro) components to be hidden in Unity

Edit: Depending on where my game character is located in the map, some text (TextMeshPro) components get hidden/turn invisible. I have tried to figure out what is causing this. With the help of a ...
0 votes
2 answers
57 views

How do I detect a hit by a swung held object?

I have an XR Grab Interactable wrench and the grab is working fine, as is movement. I'd like to use it to smash some chains, so I figured that I could use an OnCollisionEnter on the chains, and check ...
1 vote
1 answer
75 views

How to clean up list entries when objects are destroyed in Unity?

We are developing an economic sandbox somewhat similar to a mixture of The Guild and Kenshi. In this game, both the player and the NPCs will often create and destroy (consume) various objects. The ...
1 vote
0 answers
20 views

How can I refer to the render target in Unity after postprocessing?

In Unity's Universal Render Pipeline, there is a PostProcessPass class in PostProcessing.cs. What I would like to know, how I ...
1 vote
0 answers
28 views

Is it possible to add new waypoints to Dolly Track in Unity CinemachineVirtualCamera on the go?

I'm making a racing game "on rails" that utilizes generated map (similar to outrun). The map is made out of chunks that appear every time player crosses a Trigger area on the chunk that is 3 ...
1 vote
1 answer
458 views

In the Unity editor, why are the coordinates of a newly created root object not set to 0,0,0 when the object is at the origin?

My initial coordinates of a newly created object without a parent are not 0,0,0 They’re supposed to be at the origin. Instead they are some random number. And how can I set them to zero without moving ...
7 votes
2 answers
1k views

Aligning pathfinding to the center of tiles?

I'm looking to achieve tile by tile movement in a project I'm working on. I employed the use of the asset Simply A* Path-finding to allow a unit to navigate the terrain. Since the tiles are simply ...
0 votes
2 answers
63 views

Simulate Velocity For A Projectile Moving Along A Spline

I'm using Unity's latest Splines package(v2.5) to move a projectile across a spline with speed. It works perfectly and the projectile moves across the spline to it's target with linear speed. But I'd ...
0 votes
0 answers
31 views

Unity AAB build breaks with "split application binary" checked

I am currently encountering a challenge similar to the one described by a fellow Unity developer in this forum thread. I am using Unity version 2022.3.10f and configuring asset bundles while building ...
1 vote
2 answers
3k views

Unity Animator default values overwriten

I have created a project to reproduce the problem I'm currently facing. I'm running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can ...
1 vote
2 answers
30 views

Best way to implement a carrying tray in VR using Unity

I need a way to carry objects on top of other objects in VR without jitterness causing the objects to fall through a tray for example. I've tested with rigidbodies having very high friction, this does ...
0 votes
3 answers
579 views

Why do my svg sprites (vector images) appear to have very low resolution in the game view and how can I fix this issue?

I recently drew a game sprite for my game using Adobe Illustrator 2021. I exported the sprite using the Export for Screens menu to export the entire artboard. The problem I have in Unity 2021+ is that ...
1 vote
1 answer
53 views

What would be the best way to gradually increase the speed of a 2D arcade game with gravity physics in Unity?

I'm somewhat new to Unity, so I'd like to hear some more experienced thoughts on this. I'm using C# if that helps. I'm currently working on an arcade game somewhat similar to "Doodle Jump" ...
1 vote
0 answers
17 views

Do objects loaded from AssetBundle need to be unloaded after they are no longer in use?

For example, in the LocalizationProvider class a Sprite is loaded this way ...
5 votes
1 answer
515 views

Orthographic Camera is not Occlusion Culling?

In the scene where the occlusion culling is done as desired, When I change the camera to orthographic, occlusion culling is not done. (Look at the sphere the red arrow points to on the right) What ...
0 votes
1 answer
117 views

Inconsistent Speed Of A Projectile Traveling On A Bezier Curve

What I'm doing: I'm moving a projectile to it's target along a Bézier curve with one control point. The projectile moves from Transform A to ...
3 votes
1 answer
44 views

Red thing inside of capsule object that shows when running the game in Unity

There is a red thing inside of my capsule object that shows when running the game in Unity. How do I make it invisible? I have tried looking at the capsule collider, but I couldn't find anything to ...
0 votes
1 answer
978 views

Trying to define a custom Composite to the new Unity Input System but failing somewhere

I'm following the "Touch Samples" sample project that comes with the "input system" package. In one of the sample scene, there is a script that defines a custom composite Binding (for example the 2D ...
0 votes
1 answer
84 views

Converting number in name of gameobject into alpha keycode

So I have no idea if there is a way to do this, but I'm trying to find a way to turn an alpha number in a game object name string into an Alpha key code, which I'm going to use in an Input.GetKey. ...
0 votes
1 answer
1k views

Unity AudioSource.PlayClipAtPoint - controlling attenuation

New developer here, looking to do some raycasting and controlling audio positioning in 3D space based on the raycasts interactions with other objects. I've got the raycast 'casting' and able to report ...
5 votes
3 answers
9k views

Getting a pixel of Sprite at the cursor position in Unity

Summary: I've been trying to figure out a way to use simple box colliders as a nice and efficient "first pass" collider. For the "second pass", I want to check that the area clicked has an alpha value ...
0 votes
1 answer
3k views

Unity Mirror client scene.local player.connection to client.client owned object not working in client

U hmm I'm new to mirror networking I just wanna find objects that the local player has authority, but it doesn't work on client, is there a solution to this? Well I could make an object tracking ...
1 vote
1 answer
437 views

How To Calculate The Correct Sprite Dimensions?

I am creating a 2.5D game similar to Paper Mario. I want the sprites that I import to Unity to be the perfect dimensions so that quality is not affected by the camera's position. If I'm understanding ...
8 votes
4 answers
10k views

Handling movement on sloped surfaces - clamping character to sloped surface

I've noticed that a lot of people seem to have this issue but I've yet to find an actual working solution - when a rigidbody-based character controller (I'm not using Unity's character controller) ...
1 vote
1 answer
649 views

Vertex Displacement Shader Graph With The Camera Moving Issue

I have a foliage sway shader, that works well. But when the camera moves the vertex displacement stops: And the weird thing also is that if I move the camera to the right nothing seems to happen, ...
0 votes
1 answer
66 views

Optimal Approach for Transmitting and Rendering Large Pixel Art Game Maps in Unity

I'm working on a pixel art game in Unity, and my backend (Which is actually written on Golang) has generated a massive dataset of tiles for a 1000 by 1000 world (it could be even more). I'm wondering ...
0 votes
0 answers
33 views

Why do my trigger zones change rotation randomly on gameStart in editor?

I'm now doing a racer on rails like "Outrun". I do have a cool Script from internet that makes the camera and the player follow the Waypoints. The Waypoints are Trigger shapes. I have a ...
0 votes
0 answers
51 views

Why can't I limit FPS inside Unity editor?

I have an Unity app that requires a stable fps in editor. The fps itself is really high anywhere from 200 to 280 the problem is that is not consistent. I tried to limit it with the code belove but it ...
0 votes
1 answer
25 views

OnCollisionStay outputs strange contactpoints

I am currently trying to make a pen draw on a paint. I am searching for contact points on the paint but there is too much contact points than expected. I'm not sure to properly understand how ...
2 votes
1 answer
53 views

Detect if a key other than "this" key has been pressed

I'm wondering if there is a way to detect if the key being pressed is NOT matching a specific KeyCode. I tried using: ...
0 votes
1 answer
41 views

Unity 2d with the Android platform crashes with the urp package

I’m new to developing lights in Unity, I looked at the tutorials and decided to use the URP package. When installing the package, the project crashed at first, but then I restarted and the textures ...
0 votes
0 answers
21 views

Why when switching between scenes the loading transitions is loading empty scene before loading the scene in index 1?

I have two scenes: Opening Scene and Game Scene. The logic is to play the Opening Scene and then fade out then when the Game Scene has loaded to fade in when the Game Scene is already loaded. the ...
0 votes
1 answer
61 views

Unity Mirror Networking Audio Behaves Differently on Host and WebGL Client

I am creating a system in Unity using Mirror Networking which will only require one host/server and one client. It is a WebGL build so the client will connect on a browser. I want to send commands ...
0 votes
1 answer
699 views

How to fit game to screen size?

I create a WebGL game. After building project I discovered that the game doesn't fit the screen size How you can see the canvas is perfectly scaled but the game didn't I don't know what I changed but ...
1 vote
1 answer
2k views

Unity baked lighting - blotchy shadows, bleeding and/or stiching

I have spent days trying to get baked lighting to look good. I use a simple low-poly style. No matter what I do, I get this type of effect (blotchy shadows and odd dark lines): Here are my settings: ...
0 votes
1 answer
47 views

Custom Mesh with single texture - suspected uv issues

I created a script that allows me to change my meshes configuration while the app is running. I don't know meshes all that well and am running into issues with texturing. How do I need to set my uv's ...
0 votes
1 answer
68 views

How to Code Rhythm Sync

I'm trying to make an object's movement automatically sync to the music in Unity. I want a way to get the "key points" (when there is a loud beat) and make the object dash at those moments. ...

1
2 3 4 5
324