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
10 views

Why the lockState of the doors is all the time false even if in the editor I set one of them to true?

In the DoorsLockManager in the class DoorClass I changed in the editor one of the lockState to true but when running the game they are all change to false including the one I tried to set to true. Not ...
0
votes
0answers
8 views

Recursive RenderTextures don't work in 2018.3

I have a project where I'm playing with a video feedback effect by rendering to a camera to a RenderTexture and pointing the camera at a quad displaying that RT. This works great normally, but when ...
0
votes
0answers
11 views

Play a sound on button click before loading the load scene in Unity3D

I am trying to play the sound of the button click before loading the scene in unity. However, the sound is never played. Below is my code, help would be appreciated. ...
0
votes
0answers
8 views

Is it more efficient detect when audio clip ends with AudioSource.isPlaying or with AudioClip.length?

In Unity, I want to trigger an event when an audio clip finishes playing. Would it be more CPU efficient to keep checking if the audio clip is playing with ...
0
votes
0answers
13 views

Detecting closest bone

I want to show a blood spurt when an enemy is hit. I have a Vector3 (local coords), indicating where the enemy has been hit. At the start of my damage script, I store the reference of each bone for ...
0
votes
1answer
8 views

Unity WebGL player just shows black screen

I built my Unity project with WebGL. After load the resources, I can hear the music and player sounds(movements etc), but it just display black screen only. I found some similar situation in google, ...
0
votes
0answers
6 views

How launch Twitter app Android in unity? [duplicate]

How Can I Launch Twitter app On Android device I see below link but it is not work:(I could not launch with username Or with ID): https://answers.unity.com/questions/842660/how-to-open-twitter-page-...
1
vote
1answer
14 views

RaycastHit.point to local coordinates

I'm trying to detect where approximately an enemy in my game has been hit. I have added a box collider with a height of 1.8 metres to the enemy. When the player then shoots, I use a RaycastHit to ...
0
votes
2answers
31 views

Sending a shot left/right/up/down based on directional key press

I am trying to make a top-down shooter game with similar combat to the Binding of Isaac: when I press the up key the shot goes up when I press the right key the shot goes to the right I have all ...
0
votes
1answer
24 views

Quaternion.LookRotation with Joystick

I am having an issue i cannot seem to figure out within my code. What this code does at the moment is that it rotates the 3D Model around the z axis but i need it to rotate around the y axis. Any help ...
1
vote
0answers
14 views

Prefab sorting layer wrongly displayed

I have a prefab 'WhiteSmoke' that should render on top of the other objects on my game view but instead it just stays behind. The sorting layer some you see on the image named 'smoke' is the top layer,...
-3
votes
0answers
26 views

How to create “Hexagon” GameObject in unity

So i'm making a mobile 3d game, and i need to have Hexagon gameobject and yeah i searched the whole internet but didn't find any solution (i've tried blender to create hexagon but it didn't work, when ...
0
votes
0answers
11 views

How to freeze the FPS controller movement with script in unity?

I've been developing a game and I need to know how to freeze the Player position at certain point when player perform action by pressing a button and make only able to move the camera limited range on ...
0
votes
4answers
23 views

How do I make TextMesh Pro go invisible when at a distance from the camera?

I'm building a 4x game. I've rendered the galaxy, and I want the text below each star to disappear when I'm zoomed out, so it looks nicer. My stars are Prefabs with a star sprite and a 'UI' ...
1
vote
0answers
51 views
+50

High performance screenshots in LWRP

I'm trying to capture some screenshots for my game. They need to be saved as jpgs to a folder, latency is not an issue, I don't care if it happens over 10 seconds. My number one priority is to keep ...
1
vote
2answers
48 views

How can I create a random deck of 7 cards every time they are all used?

I'm trying to create a Tetris like game in C# (Unity) and I've run into quite a problem on how I can generate 7 cards (tetrominoes) of which none are the same and when I run out of cards, I regenerate ...
0
votes
1answer
12 views

Unity Canvas hover image does not trigger event

So i have the following setup: This produces the following UI: Now on each of the "HudCircle"(Bottom/Right/Left/Top), I have the following components: As you can see I have a script that has the ...
0
votes
0answers
8 views

Can't refer mesh size after using .BakeMesh() in Unity

I can't figure out how to refer to the size of a particular mesh. The mesh is created through .BakeMesh(), then a box collider is added. Unfortunately the box ...
0
votes
0answers
26 views

Simple shader that scales UI image from the center

I'm having trouble making a (vertex) shader that scales UI images from the center. I can scale the image, but the image doesn't stay centered. Here is a project showing the problem Here is a ...
0
votes
0answers
13 views

Spawned Network Object with rigidbody moves at different velocity/angle/pos on the clients/host - Unity Unet Mirror

I am using Mirror API with Unity 2019 to make a basic multiplayer game. The game is a simple ice hockey style with cylinder shaped players and a cylinder puck. The players are spawned by Network ...
0
votes
1answer
25 views

In Unity how can we implement the Bull Rider Controller?

There is a Sports (Bull Rider) in which a person sits on the top of a Bull and grasps the rope to controll a Bull. The Bull kind of moves to and fro. The player has to balance him/her self. I have ...
0
votes
1answer
21 views

MoveTowards object stuck with isTrigger Collider

I am trying to have a missile seek its target once it has entered the target's trigger. The code should be fine, I think it has something to do with how the colliders are operating. I want the blue ...
0
votes
0answers
19 views

Resolving this kind of situation in my platformer (movement on slope with roof)

I'm building a simple 2D character controller based on raycasts. At this moment I'm trying to finish the player-ground interaction. For the ground I will be using edge colliders and no tiling ...
0
votes
0answers
12 views

Unity3D mobile 4G internet web request is very slow

I have a windows VPS server and i have installed an Apache server on it. in my server I only have a simple text file that contains some few words. My problem is that when I'm trying to sending a web ...
1
vote
0answers
21 views

Seaming between procedurally generated terrain meshes in Unity

I have been generating procedural terrain for an upcoming project however I am coming across a seaming effect between the tiles: I have searched for solutions including this video. Here is the code (...
0
votes
0answers
18 views

Show Sprites on Overlap (Shader Graph) [2D]

I have a character sprite mesh and mesh renderer (The black wavy box). I am hoping to be able to overlay the black box onto the character covering the sprites but I am not sure how to do that. I ...
0
votes
1answer
48 views

Changing the camera in Unity

I am trying to make a game like mario party in Unity. I want the camera to automatically change between players after each turn. I don't have a lot of experience in C#, and I totally would learn about ...
1
vote
1answer
58 views

Is there performance difference between OnCollisionEnter and OnTriggerEnter?

Is there performance difference between OnCollisionEnter and OnTriggerEnter? I have around 12 objects all calling OnCollisionEnter when in fact OnTriggerEnter could work as well. So I wonder if the ...
0
votes
2answers
54 views

Problems generating procedural mesh

I have this code below that I found on catlikecoding that generates a procedural grid that I want to apply noise to, however once I go over a certain value it does expand vertically. Can anyone see ...
0
votes
1answer
46 views

Smoothen line on linerender

I've created a square using linerenderer but my problem now is that the line is not smooth. see below picture. I've tried enabling anti-aliasing and setting lr.numCapVertices to no avail. ...
0
votes
1answer
40 views

Unity - Play animation based on horizontal drag position

So, what i want to do is some what complected, but I'll try to explain it to the best of my ability. I am using Unity's EventSystems events to detect a drag. When the user drags the object ...
22
votes
1answer
6k views

How do I prevent inappropriate ads from appearing in my game?

My game implements Unity ads, and is designed with a universal audience in mind. As such, I would prefer not to have 18+ ads (or even 13+ ads depending on the circumstances) appearing in it, ...
1
vote
2answers
56 views

Select Unity Prefab from enum choice

After a couple tries, I still haven't found any solution to this problem of mine. Currently, I have a script inheriting from MonoBehavior which creates a map with Perlin Noise. Let's call it ...
4
votes
0answers
49 views

How can I make Unity run fast when it's not focused?

I'm using Unity3D. I have an automated test suite that takes 1-2 minutes to run. When Unity has focus, these tests seem to run at least 2x as fast as when Unity is in the background. But, it's very ...
0
votes
0answers
31 views

How can I change the parameters of the random events for each game entity?

I'm trying to write an easy-to-use random event system that has certain conditions and effects in Unity. It's a simulation game that contains multiple Person, City, Country, Faction elements. I have ...
0
votes
1answer
32 views

Why Some objects or prefabs don't respond to mesh collider?

I imported some assets and, I used some prefabs from that assets. Some of them responds when I add the component of mesh collider to it and disable the ability of going through with it. But some of ...
0
votes
1answer
20 views

How To Deselect (Unfocus) All gameObjects in a Unity Scene View?

When I'm done with moving and rotating gameObjects in a Unity scene, I want to deselect everything to not accidentally change it. How? In some applications ESC key does the trick, in others 'D' (...
1
vote
1answer
68 views

Why do my NPC's fall through the world when I select them as triggers?

I'm making a game in Unity where when the player comes into contact with an NPC it will switch scenes. I have the code for it and made sure all NPC's have rigidbody as well as using gravity and convex....
0
votes
0answers
13 views

Using Azure with Unity

I currently use Unity 2018.3.9f1. I would like to hook up my Unity program to an Azure service, so that I can store/analyse information about user behaviour. As a primer, I tried to import the ...
0
votes
1answer
51 views

Make half of the sprite transparent

Guys if I have two sprites placed on the same spot. How can I show the half of each Sprite instead of the one on top? The sprites are basic circles All sprites have basic colors, no textures.
0
votes
0answers
33 views

How does Unity store references to GameObjects in a scene

A Monobehaviour can have references to GameObjects in the same scene, but Prefabs, ScriptableObjects can't reference GameObjects in a scene. While Assets, Objects and serialization covers references ...
0
votes
1answer
50 views

How can I draw a rectangle with a color gradient?

I'm trying to implement below picture in my code but doesn't work. It only shows red color on all sides. I'm using line renderer and color gradient. Kindly check my code. Thanks in advanced ...
0
votes
1answer
24 views

Unity Proximity Warning System Trigger issues

I'm trying to set up a proximity warning system but I'm having some trouble. To simplify things as much as possible: I have two game objects in a scene (Object1 and Object2). Object1 has a large ...
0
votes
0answers
60 views

Why is the play button not working on the title screen of my game?

I'm trying to open up a game demo from my class to see what it looks like, but after opening up the project in Unity, the title screen doesn't work correctly. When I try to click the "Play" button, ...
1
vote
0answers
16 views

making a tangram game in unity, how to detect when shapes match

I'm making a 2D game in Unity that's kind of like tangrams, and I wanted to know how I could check to see if the 2+ shapes together make the shape i'm trying to match. The shapes I'm putting together ...
0
votes
1answer
44 views

Integrate Stripe with Unity

I'm trying to install the Stripe API Library through NuGet Manager in Visual Studio but it installs it inside packages folder of the Project (I.E. before Project's Assets folder) doing this I cannot ...
1
vote
0answers
30 views

Changing color for each element in linerenderer not working

I want to change color for each line (element) just like in color switch. But my code is not working. What I wanted is that the right line should turn blue then the down line should turn color red. ...
-2
votes
1answer
32 views

How many unity version support with 1 seat?

I bought plus unity license 1 seat so Can I use it on 2 unity version Example: Uity5.3.4p3 and unity 20183.18f1 Or it use only for one version?
0
votes
2answers
33 views

Unity3D - Generate a position within a circular band around the player

Given a certain condition in my game I need to generate a position around the player. It needs to be at least 8 meters away from him and within 10 meters, in a circular matter, as in the dotted green ...
0
votes
1answer
27 views

Downloading image to apply as a Texture fails

In my app I need to download some images and apply them as Textures. If I use following code to get image from my local pc hard disk, it works. But it does not work if I use a url like (http://www....