Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
32 views

Tile draws pixels from adjacent tiles

Whenever I try to draw from the tile palette, this is the result. why does this happen? I have tried messing around with the palette, how the sprite editor has sliced the tiles and played around with ...
2
votes
1answer
29 views

On changing a voxel, don't recombine everything again, only modify the changed parts?

I'm working on a voxel based game, where destructible structures are made out of cubes. (Some of them has 3000 voxels) I solved the framerate issues by combining them, but after making it able to ...
1
vote
1answer
404 views

XInputDotNet not working when building for UWP in Unity

I am working on a game where a controller has to vibrate. I have found the XInputDotNet plugin which worked very well in the editor and a normal windows build, but if I build for UWP (both Xaml and ...
2
votes
1answer
10k views

How can I make caves with Unity's terrain creator?

With Unity's terrain creator, I can't simply make a "hole" on the mesh. I don't know how I would make cave-like structures other than using "rock" meshes for the roof (wich will indeed look weird) ...
0
votes
3answers
108 views

Getting grid coordinates of cells bordering a square region

I have a board that is 4x4 ( the blue cells) with the origin (0 , 0) being in the bottom left for example, how can I get the coords which are adjacent to the board (the red cells) to store them in an ...
0
votes
0answers
17 views

Unity - How to add bones to procedural mesh

Basically this is the set up: An N amount of prefabs are bundled together into a new GameObject. This is then merged into a single main mesh composited of M amount of material submeshes. The shape is ...
1
vote
1answer
73 views

unity how to automate changing sprite editor setting

I have a bunch of hex tiles that I want to import into a tile palette. However their pivot point needs to be set to y 0.35 when the default is 0.5 I could edit the import settings in the sprite ...
0
votes
1answer
49 views

Assigning relative force to a projectile fired while orbiting a sphere

Projectile Not Correctly Inheriting Parent Velocity (Unity3D) So I am trying to incorporate the above person's changes into a script I am making although I'm no great coder and I'm not even sure ...
0
votes
1answer
92 views

How to change music from room to room?

In Unity 2019.3.0a2 I have a labyrinth with multiple rooms. I want the music to change when I get from one room into another. How can I do it so that music from room 1 is only hearable in room 1, and ...
1
vote
2answers
333 views

Without official outline script, can I do text outline in Unity?

Since there are more tris and verts generating, the official outline script isn't a good way to do text outline, is there any other way to do that with better performance? TextMesh Pro may be the ...
9
votes
2answers
483 views

How to avoid spaghetti in the animator?

I am working with animations in Unity and so far I have made only four (Up Down Left and Right) and my animation window looks following... Problem is that if I was moving Up I want hero to stay ...
1
vote
1answer
44 views

Strange artifacts in Unity Lightmaps

I experienced this weird lightmapping bug in my game that causes some models to have glowing artifacts on their surface. These artifacts "move" around, when I edit the UVs of the model in Blender, so ...
0
votes
0answers
24 views

Why occlusion culling isn't working?

I've bought a 3d model from a 3d marketplace. It is a big interior scene. I've imported the single FBX into Unity, added some collider, changed materials (6-7 materials) etc. There are hundreds of ...
0
votes
1answer
52 views

Verifying that two words match — false negatives

In my first game, I am trying to validate whether two words match: whether an input word matches a reference word from an array. Unfortunately the only word for which it finds a correct match is the ...
0
votes
2answers
175 views

Camera.main is not what the user sees

I'm developing (or rather butchering) plugin for Rust, which was build in Unity, and I need to create a targeting system. Unfortunately I got stuck on ...
3
votes
2answers
61 views

How can I play a particle system only when it's visible?

I am making a game and it has a lot of particle systems in it as special effects, and all of them are supposed to be playing at the same time, but doing that will be heavy on the game's performance, ...
2
votes
3answers
917 views

Can't get the current animation state name (hash or .IsName) to work

I have some hard times trying to get the current animation state name in Unity, to perform specific actions while I'm in a certain state. I want to know when I'm the "ThoughtsStill" state, I only have ...
0
votes
1answer
23 views

Can't Transform.SetParent in Unity

i have a problem that i don't understand why is happenning and it's driving me mad. I'm trying to code a script to put the player in the car by disabling the third person controller and then Transform....
1
vote
1answer
37 views

Are realtime lightning calculated every frame , also the ones not 'visible'?

I've a big scene, with a lot of realtime light. I noticed a big drop in FPS after finished to add lights, so I suppose that too many realtime light are a 'bad practice'. But my question is: are all ...
0
votes
1answer
59 views

How to Set PlayerPrefs.SetInt?

playerpreferance.setint problem I am develop one game.In this game 15 levels. I am face this type of issues when send one level score into second levels. I am used player preferences in start() ...
0
votes
1answer
325 views

Standard Asset package import in unity 2018.3

I am using iMac, I don't see any for import standard package in unity. My working project need to import standard packages. I use unity version unity 2018.3.0f2. Please guide me from where I get the ...
0
votes
0answers
21 views

Restrict Trajectory on Z axis

I have a cube which I select on mouse and point out the location to throw the cube with trajectory dots. The code is working fine, but I need to restrict the trajectory dots position on z axis so the ...
1
vote
1answer
33 views

How to call animation event from another GameObject

I have an animation event but I want it to call a function from a script that is attached to a different GameObject that I'm not animating. Is this even possible?
0
votes
1answer
23 views

Instantiate an object and translate it randomly

My goal through this code in C # is that each time the player presses the Q I create a cube at a fixed position given by another object, then begin translating it in a random direction. ie. first ...
0
votes
1answer
57 views

How could I format my C# code using Checkstyle?

Is there any possible way to check my C# code with Checkstyle in the context of Unity?
0
votes
1answer
13 views

Unity3d : Access the OnClick parameters of Button in a script

I have a button and I have attached another script "PlaySound" for this button, which plays audio on button click. As soon as the audio gets completed, I want to ...
1
vote
1answer
34 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 ...
0
votes
2answers
57 views

In 2D, how can I improve character rotation using raycasts when dealing with sharp/convex edges?

Edit: After making some edits to my polygon collider (based on @Alex F's suggestion), I can indeed confirm that sharp, convex corners are causing the buggy ...
1
vote
1answer
42 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
1answer
28 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 ...
4
votes
2answers
13k views

Screen record in unity3d

How to do screen record in unity? I want to record my screen(gameplay) during my running game. That should be play/stop , replay , save that recording on locally from device, open/load from my device (...
0
votes
1answer
40 views

Player is instantly teleported back

I built a teleporter that changes a players position and rotation. He is instantly teleported back. Why? I'm using the standard FPS Controller.
0
votes
1answer
18 views

Rigidbody2D moves on x axis without adding force

I'm currently trying to learn some Physics2D in Unity. Now, I've created a Ball (sprite) and added a RigidBody2D and a CircleCollider2D on it. The RigidBody2D has the following settings: Bodytype: ...
0
votes
1answer
362 views

Why do I have to set my Unity app to full-screen manually on my phone

When I open my unity app it doesn't go full-screen until I change it in the settings, isn't there a way to do that..(I'm a noob)...it actually isn't a scalling problem or an aspect ratio.... Because ...
0
votes
1answer
21 views

Unity Events executed out of order

According to this page Events in unity are suppose to execute in a specific order. Specifically, OnCollisionEnter is supposed to be called right after OnTriggerEnter; however, FixedUpdate and Update ...
0
votes
0answers
15 views

Creating a new HDRP example scene after upgrading Unity project

When a new game is templated using the HDRP template, there's a nicely setup sample scene with post processing volume and many other settings. I have noticed that Unity changes quite a lot in their ...
0
votes
1answer
18 views

Audio Clip not working on Collision when destroying an object

So I made a game where you shoot a laser and if it hits the enemy it makes an explosion sound and destroys the enemy. The only thing is whenever I try to get the audio to play it doesn't which I ...
0
votes
1answer
79 views

Unity | Camera - Follow target with view port point's offset from center

Some additional remarks before I address the issue: How Viewports work in Unity: Whatever the dimensions of the screen's rect, the viewports coordinates are mapped in normalized coordinates, where 0 ...
-1
votes
2answers
183 views

Sebastian Lague's A* star pathfinding “On condition”

As the title suggests I have been following the wonderful series of tutorials dealing with pathfinding made by Sebastian Lague. My problem is that the code is meant to be working immediately after ...
1
vote
1answer
96 views

Draw trajectory arc predictor in game

I found this tutorial on youtube and it works pretty well, but I want to add more to it. How can I draw a smooth arc path in the game view (right now the path is only visible in the editor)? Here ...
0
votes
1answer
17 views

Magicavoxel export to Unity offcenter

I am trying to export an object from Magicavoxel to Unity. I have exported it as an obj file and dragged it into the scene, but it is completely off centered ...
1
vote
2answers
51 views

How can I make a look around effect of the player some kind of cutscene?

I want that at some point in the game the player will be looking over the view out of the window. So I added a new Camera and positioned the camera close to the window. Then using a small script I'm ...
0
votes
0answers
21 views

Ship Banking Animation - the best way?

So I am learning Unity right now and am making a standard space shooter. Im at the point where I am trying to make my ship look like it is banking left, right, forward or back and have a few ...
0
votes
2answers
642 views

Unity NavMesh pathfinding using Job System

I'm trying to write a system where I can run each enemy's NavMesh pathfinding in parallel, using Job System. The problem I'm having is that I can't pass the NavMesh agent argument as it's a reference ...
3
votes
1answer
125 views

Predicted trajectory becomes less accurate in a side-on collision

In my 2D billiards game, I have it so that when the user clicks and drags with their mouse, a Physics2D.CircleCast is projected from the cueball to wherever the mouse is. If the circle happens to hit ...
2
votes
3answers
2k views

Separating lighting for interior & exterior parts of a scene

I want outdoor areas connected with indoor areas. I use the default setup in Unity. But as you see in image, indoor point light affects the outdoor area (through the walls) and the skybox does more ...
0
votes
1answer
16 views

Unity3d OverlapSphere and raycasting problem

I have a grenade (rigidbody) which make a spherecast when it detonates. On each found colliders, i will make a raycast to check if it is visible to the grenade or not. ...
0
votes
2answers
22 views

Unity crossplatform native plugins

I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is ...
0
votes
0answers
19 views

Approach to storing multi-cell-objects on a sparse Grid (Example: Buildings in Anno)

I am currently working on a citybuilding game and planing on how to store buildings on the map. In previous projects I used either a grid where each Object was exactly 1 cell; or Unity Objects ...