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
2
votes
1answer
887 views

Keep the prefab connection with FBX

The steps I have perform: Added an FBX in UnityProject. FBX added to scene hierarchy. Made Prefab of the FBX. Everything is working fine. Now I added a script to the prefab and make some object ...
1
vote
2answers
370 views

UI Button OnClick not playing AudioClip on gameObject

Basically, I am loading an Audio Clip onto a game object's Audio Source in the Awake function when the game starts. When I click on the game object a UI comes up that basically has a Play button ...
0
votes
0answers
5 views

Unity Applying Global Light Settings fog to a non-main camera

Is it possible to apply fog to a non-main camera?
1
vote
0answers
12 views

How to prevent Dynamic Rigidbody2d with large mass pushing another Rigidbody2d into BoxCollider2D

I'm making a prototype for a game idea but hitting a problem :( Quite new to Unity and feel like this should be relatively easy to solve, but keep going around in circles, and hoping to get some help :...
3
votes
1answer
1k views

OnMouseDown() and Collision not working for game object created within another game objects script

I have created a game object (Brick) and added a script (BrickScript) to it. Within this script I create a Window game object if ...
-1
votes
0answers
24 views

How do you continuously spawn an object after it hits a certain mark?

After my tile platform reaches 70 in vector, I want my object to spawn throughout the vector but it just stops after it reaches the 70 distance ...
0
votes
1answer
51 views

Sticky Conveyor Belt

I'm working on having a sticky conveyor belt, so that objects can also go around it. But my objects currently get stuck half way, as seen in the picture. This is the movement code of the conveyor ...
-2
votes
0answers
16 views

Facebook Friends Profile Picture and Leaderboard in unity

I am creating a leaderboard of player and his friend. So far I am downloading the pictures each time the user goes to the leaderboard scene. How to check how much mobile data is being consumed each ...
0
votes
0answers
18 views

.blend scenes are not showing texture in Unity

I am new to Unity and Blender. I am getting a problem when importing .blend files into Unity: in Unity scenes the textures created in Blender are not showing. But ...
0
votes
1answer
316 views

Unity2D Multiplayer - Spawning player at user's end

I am currently into a 2d mobile multiplayer project. Its going to be a 2 player game for now. So the host and the client are the only players. I am using Unity 5.4 and the default multiplayer ...
0
votes
1answer
23 views

Move Object θ Degrees Over T Time

Note, this happens on click and not in the update cycle I have a game object that i rotate at a given angle, around a point without a time component like this(works as intended): ...
0
votes
1answer
40 views

Having multiple different friction values on a single piece of track?

I am trying to figure out a good/performant way to give a piece of track multiple values of dynamic friction. A track piece is 10x10 units in Unity and the idea is to puzzle them together to a big ...
0
votes
1answer
19 views

RigidBody or Character Controller for Zero Gravity first person shooter

I am developing a single person, first-person shooter that takes place in space. I want to be able to simulate zero gravity. Should I use a Rigid-Body or a Character Controller?
0
votes
1answer
45 views

Understanding Physics Materials

I have been reading the documentation about Physics materials, and it really seems very incomplete to me. When I try to work with it, I get so many questions... Maybe can someone help me wrap my head ...
1
vote
1answer
48 views

Reacting to button holds of different durations for an anxiety game

I am working on an interactive game to aid with anxiety management. In one of the gameplay options, the player has to press buttons for a certain amount of time. Only after the required time has ...
0
votes
0answers
12 views

Billboard nametag not working

I'm using PUN2 and trying to use nametag billboards for my players but it's not working. I think it has something to do with me destroying the camera on the player controller script. When I load the ...
2
votes
1answer
528 views

Unity5 TextAsset not functioning in WebPlayer [closed]

Preface I am working on a 2D Platformer in Unity5 utilizing TileMap techniques. I have a working system to read "Room Tile Data" from JSON files with the Unity <...
1
vote
1answer
546 views

In Unity/UNet: How do you properly spawn a `NetworkPlayer`?

In Unity/UNet: How do you properly spawn a NetworkPlayer? Right now, I'm doing it like this from inside a NetworkManager ...
0
votes
0answers
28 views

Let player paint in constrainted hexagon grid

I am creating the hexagon grid, in which I would like let the player to paint map, I have come this far by now: I have found how to get position of cell in grid. I have found there is ...
0
votes
3answers
118 views

How to switch between multiple cameras in a Unity Scene, Silent Hill-style

I have 3 cameras in a practice scene that I want to switch between. Currently, I have a meshless cube acting as a trigger with the following script ...
5
votes
2answers
376 views

unity / blender — positioning items / clothes on character

I'm aware that in Unity, when you want to add (e.g.) a weapon to a character, you parent it to the "hand" bone of the character etc... Well I'm trying to add a hat to a character in unity when it's ...
0
votes
2answers
2k views

How can I avoid a stack overflow when recursively checking adjacent game objects?

I am building a simple game on Unity to learn the system. I am using C#. The game is a basic "blocks" game, whereby when the player clicks on a block, the block and its neighbours of the same colour ...
0
votes
1answer
949 views

Google Play Games not working with Unity

I have been having real problems getting the Unity plugin for Google Play Games to work. At one point it was working great. Could login, write to leaderboard and save/fetch games. Suddenly it all ...
0
votes
1answer
37 views

New Input System Differs Between Editor and Runtime?

I'm sure the problem is me. Here is a simple look script (from a tutorial, actually). I'm getting inconsistent results between editor and runtime. I'm guessing its a framerate thing. Code: ...
0
votes
2answers
86 views

Changing animator via scriping

I am using the following code, my intention is whenever the 2 objects meet the animator boolean changes and when leave change back to its original setting. But it doesnt seem to work. ...
2
votes
2answers
143 views

Load order of networked objects in Unity

I am making a 2D RTS, and am trying to get a multiplayer version working. I've run into some problems with the order that scripts are getting executed. For the host everything runs fine, but when a ...
1
vote
1answer
98 views

Optimizing spawning 500 objects every 3 seconds

Using Object Pooling, assuming I'll like to spawn 500 cubes once every three seconds. How do I make it performance friendly? I need ideas, not the code itself.
2
votes
1answer
43 views

Unity: How to Retrieve Port Number Used for Test Build

SUMMARY I am looking for a straightforward way to get the port number that the Unity editor is using to serve WebGL test builds after the build's browser window has been closed. I'm supporting Unity ...
1
vote
1answer
408 views

Avoiding GC Allocation in Unity UNet API

I'm trying to profile the game using Unity Profiler, I can see in the Hierarchy tab that there's an 18.3 KB correlated to ...
0
votes
0answers
15 views

How to purposely overscan a Unity Camera?

For many shader effects that use the scene color, we want this color to be displaced along the object plane. Think water, glass, heat distortion, etc. However, of course, if this happens near the ...
-1
votes
1answer
28 views

How can I get the basic Unity player controller to move based on a gameobjects rotation?

I am making a basic movement script based off of the built in playercontroller in Unity. I am trying to get the Player gameobject to move forward based on its own rotation (i.e. if it is rotated to 90 ...
1
vote
1answer
29 views

How to select light as sun source

I tried to add a sun in the lighting setting. I have a directional light in my scene, but i can't select it as sun source in lighting setting. The light does not appear in the list. Does anyone know ...
0
votes
1answer
23 views

How can I add orbit effect to the camera?

On my player I have the component Animator , Rigidbody , Capsule Collider , Third Person User Control script , Third Person Character script. On the Main Camera there are two scripts but only one is ...
1
vote
3answers
7k views

Irregular Shaped Colliders For Unity

Is it possible to create an irregular-shaped collider? If so, how? Would I need to create a couple objects and group them up into one Game Object?
3
votes
2answers
5k views

Writing and reading Computebuffer in a Shader

I'm trying to write into a Computebuffer in the fragment shader, but it doesn't work. Its pretty hard to get the Depth-Value in the Compute Buffer, so it would be so easy to just use the Pixel/...
2
votes
1answer
573 views

Game communicates with MongoDB in the Editor but not in WebGL build

I was trying to implement MongoDB in my Unity WebGL game and everything is working fine in the editor: I managed to insert and retrieve documents from my Mongo database with no issues. Everything ...
0
votes
1answer
37 views

Cursor is locked and hidden, and can't click UI

I have a player with a third person character controller component. I have a problem with the cursor lock: it hides the cursor so I cannot click UI buttons. ...
0
votes
1answer
14 views

Working with Screen Space - Overlay canvases

So, say you've started a new project. You drop your in desired sprite. You can see how big it is relative to the Main Camera. That's cool. Now you want to add a persistent bit of UI to the game, so ...
0
votes
1answer
37 views

get access to Transform of a Clone in Unity

In my game when you lose, A panel with a button on it appears and if you don't have enough coins, You may be directed to shop by hitting shop button. when buying is completed you can return to the ...
1
vote
1answer
215 views

In Unity, how do I set constant player numbers such that all network clients agree on them?

We are currently writing an online game in Unity. The essential idea is that it is structured like a split-screen, couch co-op game, with the online being offered as an extension to allow multiple ...
0
votes
0answers
14 views

Help with Unity global illumination removes cel shaded effect

So I am using this toon shader I got from the asset store that supports global illumination. However it seems like the global illumination destroys the cell shaded effect, and when in shadow it looks ...
0
votes
0answers
20 views

Streamline login, so user types their ID just once

I have been watching tutorials and have these two scripts that I didn't write. One script asks for the username for the player to input. When the player enters the room I have a chat system that pops ...
0
votes
1answer
10 views

SetCursor: Cursor does not contain a definition for "SetCursor' or why can't I re-assign the cursor in Unity 20194.7f?

Here is the code I used on Cursor script, attached to a chest object. ...
0
votes
1answer
20 views

Unity Animator animations fail to play only when triggered by user input

I have a unity animator setup like so. When the game runs, I can trigger each state in the state machine with user input. I can use HasExitTime flag to trigger the ...
0
votes
1answer
47 views

Player jitters when Jumping at object edges

So I have a bit of an issue with my Player controller script. Everything works fine except with very specific jump cases. If I jump at an object and I don't reach the top edge I will just fall ...
0
votes
1answer
39 views

Canvas not scaling to screen size

So I have a very simple scene set up with just a camera, a game object called TestGrid with a grid script, and then a canvas. I have a TextMeshPro prefab that I instantiate to fill the 10 x 20 grid ...
0
votes
1answer
72 views

How to make a cell shader like BOTW in Unity?

It seems most cell shader tutorials focus on individual shaders for materials, but the effect used in BOTW seems to be more like a filter, that is applied to everything. I've researched multiple ...
0
votes
1answer
30 views

EventSystem.current is null

private void OnEnable() { Debug.Log(EventSystem.current); EventSystem.current.SetSelectedGameObject(gameObject); } Very simple script for selecting a UI ...
0
votes
1answer
53 views

Unity: Shader Graph and GPU-Instancing?

Unity Version: 2019.4.1f1 Render Pipeline: URP I created a shader using Unity's ShaderGraph, and i want to apply GPU Instancing ...
0
votes
1answer
44 views

How to set the z axis bound of the collider of child of an instantiated object to zero

I have attached a script to an empty GameObject to instantiate a prefab and the script is: ...