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.

7
votes
3answers
3k views

How to move the player while also allowing forces to affect it

For now, that's how I move the player: rb.velocity = Vector2.right * input.x; And I affect him a force while he is damaged by an entity: ...
0
votes
0answers
13 views

Use references to UIManager script or direct for children OBJs

So I've got a canvas with UIManager script attached to it, the canvas has a lot of buttons and texts as children OBJs and they somehow need to communicate to each other. Should this be done through ...
0
votes
0answers
42 views

Is Google Play Games Services Multiplayer (Turn based) free? Is there any limitation on number of users?

I was just visiting Google Play Games Services guide for signing In in Unity. I just came to know there that Google Play Games also provide services for Multiplayer. I'm currently working on my Indie ...
0
votes
0answers
15 views

How to load an AudioClip at runtime without the WWW class?

I am currently pulling a .wav file from an API. I would like to play it at run-time. Currently I need to save the .wav file to ...
0
votes
1answer
26 views

pass by reference a transformation

I create a C # script in which I declare a transformation: public Transform Origin; When I put this script on an object of the hierarchy, in the Inspector a field Origin appears at the level of the ...
0
votes
0answers
87 views

How do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d?

I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. ...
0
votes
0answers
35 views

Help to Code Bowling Like Feature in Unity for Mobile

I need Code or Guidelines for Touch Feature. When We Drag ball back and Send it Forward. I am Making feature like bowling, and I need Player to add force while dragging back and also curve the path of ...
1
vote
1answer
68 views

Best C# technique to pass variable from Instantiated object to GameObject

There are lots of instantiated prefabs. Info from it is transmitted while it crosses a trigger zone. Some of these are calculated custom variables. I can print the custom variables from the ...
0
votes
0answers
19 views

How do I determine the distance between two points in tilemaps in unity?

If I have a tilemap with multiple layers, is there any way that Unity offers to help me infer the distance between the two points? Also, as a related question: Are there any libraries written in C# ...
0
votes
1answer
11 views

What is causing my 3rd person camera to lose rotation on the z axis?

I've been working on a 3rd person camera on unity for a couple weeks, but I've pretty much hit a wall, specifically to do with my camera's rotation. When I rotate it on its x and y axis it won't have ...
1
vote
1answer
27 views

Camera that pivots in the direction that the player is moving

I'm trying to recreate Rocket League's freeform (non ball-locked) camera, which basically is a camera that follows the player but pivots to allows face the direction the player is moving in (not ...
1
vote
1answer
17 views

jumping and movement with rigidbody2d.velocity, gravity problem

i'm making a 2d platformer and i move my character with rigidbody2d.velocity swiping up to jump and moving while holding the left or right side of the screen. the problem is that when i jump and i ...
0
votes
1answer
17 views

How can I get sensor data on iPhone onto a Windows PC? For use as a steering wheel

I am making a Unity game. I want to be able to allow the phone to be used as a steering wheel, as input into the PC game. Technically, How can I achieve this? Can this be done through bluetooth? ...
0
votes
1answer
29 views

For creating a distant moon in a 3D game, is it better to use a model or texture?

I'm working on my indie game and I want to create a moon (it's a 3D game) however I am unsure if I should create a model and put it far away, or if I should use a texture on a plane and have it ...
0
votes
0answers
9 views

Unity, getting a null reference after baking in occlusion

I have imported models from blender into Unity, also checked generate lightmap UV's in the import settings. Then I set the model as static and baked the scene. After that when the object is ...
0
votes
0answers
18 views

On Unity how do I play an animation on drag direction?

I am trying to make an animation start when I Drag the mouse inside a picture and move it it left and down. while dragging the mouse pulling the nose down and left. I am not sure how to go about this ...
0
votes
0answers
33 views

Do I need a server if I only want to upload data to a DB?

I'm currently creating a game where people get some kind of reports for their game performance on a website. Let's say, you log-in, play the game, the system gathers your performance data and this is ...
0
votes
0answers
22 views

How to let a gun follow the camera while characters hands are following the gun

I have made a character using MakeHuman, imported to blender and created a view animations. Then I imported the character as .fbx file into Unity. I set up an FPS scene with a player holding a gun in ...
-1
votes
0answers
17 views

How can I make my car speed gradually increase overtime?

I am making a drag racing game and I want my car to accelerate until it have reached its set top speed. I am kinda new to game development so I don't much, so please help me. If I could also get a ...
1
vote
0answers
19 views

Circle ceases to be a circle when radius is below a certain value

I'm using the LineRenderer component to draw a circle. It renders fine, but it's a little too large. The smallest I can set the radius is .06f. If I try to set the radius to anything less than that, ...
0
votes
1answer
13 views

Unity: Change the type of a Texture2D to “Normal map” through script

I am making procedural terrains through c# script, and while I achieve to produce a texture, a heightmap and a normalmap to Texture2D, it seems they are not being ...
0
votes
0answers
11 views

Generating Mesh using Compute Shaders

I am working on a game project in unity which has a procedurally generated terrain made up of 16*128*16 chunks of blocks. The map size is going to be finite (Possibly up to ~100*100 chunks). Currently ...
0
votes
2answers
52 views

How to change 100 GameObjects' color without pushing RAM to hard?

I'm developing a mobile game and one of the gamemodes has 100 gameobjects(basic cubes). And they all have same material. I need to know how to change their color one by one with script. I'm not very ...
0
votes
1answer
24 views

inject GetComponentInChildren

How to get access to the child components using the list, I tried to inject in the traditional way equal to the array, getcomponentInChildren always gets this error. ...
0
votes
0answers
24 views

Unity: how to position items into a Scroll View?

I'm trying to add items (prefab) into a Scroll View but either if I simply add items without set positions and trying to setting position it not work. Case 1: without setting position Result: All ...
2
votes
0answers
61 views

How to create a tube 2D in unity

I want to create a 2D tube in unity which I can cut, suture and drag it, My idea is to use a small image in form of fragments but how i can do it like the picture bellow EDIT : What I did until ...
0
votes
1answer
43 views

Dividing Data and Logic in Unity

I am currently working on a small side project (as usual), and trying to build up from previous experiences. I have the following elements in the game: 1) Region: ...
0
votes
0answers
31 views

No Support for UnityScript (JavaScript) on 2018.3

Hey I’ve been working on a project for over 3 years and yesterday I have updated the unity from 2018 to 2018.3 and lost support for JavaScript. All of my scripts attached to gameobjects are there but ...
1
vote
1answer
41 views

unity JsonUtility.ToJson returns empty string

I am trying to use Unity's built in json serialization. It produces empty string. I do not understand why. (I was trying to use NewtonSoft Json.Net but that wasn't working either even though I was ...
0
votes
0answers
17 views

Increase sound tempo in Unity when new player joins in Kinect game

I'm using Unity to create a Windows-build game with Kinect. I have some drum beats, which can either be used as single sound effect or be edited to be a piece of continuous music. I want these drum ...
0
votes
1answer
21 views

How to add state to the custom inspector in Unity

I'm writing a custom inspector for my asset (by deriving from Editor), and I have a few variables controlling the state of the inspector (like whether a foldout is ...
0
votes
1answer
35 views

How can I change a sprite used for a Unity Tilemap tile at runtime?

I want to change Tile's sprite during runtime, but it doesn't render. ...
3
votes
1answer
38 views

Making the camera look at the player while keeping another object in view

I'm working on a sorta football game where I need my player to always be at the center of the camera view while keeping the ball into view, without any vertical movement. The idea would be for the ...
0
votes
0answers
28 views

How to Play YouTube Videos Within Asset Store for Unity

On every computer I've ever tried to use Unity, the Asset Store seems incapable of showing the YouTube video previews of assets. It always claims my "browser" does not currently recognize any of the ...
0
votes
2answers
55 views

Background music not stopping while game is set to paused

I am implementing pause game functionality in a Unity3D game using the following script ...
0
votes
0answers
23 views

Spin camera around origin/focus in Unity editor

I have used Blender a bit, and like the way the camera in the editor orbits around the focus/origin when dragging with middle click. I've recently been using Unity a little and despise the camera ...
1
vote
1answer
49 views

Is Rigidbody needed and what move function to use in 2D games?

I don't really fully understand how to use rigidbody and which movement functions in a 2D game. There seems to be so many options and it's just a mess in my head right now. If I'm making a game like ...
0
votes
1answer
27 views

How to get the tangent and normal of a collision?

In my game, one of my objects casts a ray into a 2d space. If that ray were to hit another object, I'd like to draw a line that is perpendicular to the tangent of the ray's hit point. So when the ray ...
1
vote
0answers
36 views

since unity upgrade, OnSceneLoaded not getting called on scene start

I upgraded my unity project to 2018.3.11f. Since that upgrade, the OnSceneLoaded event is not getting called, even though I am registering the event handler. Here'...
0
votes
0answers
28 views

Why do I get a “Value Cannot be Null” error on material.SetTexture?

Probably a really noob question, but: I'm following this tutorial here and, using the code in the tutorial, I'm getting an annoying error: Here's the code in question, the error is referring to line ...
0
votes
0answers
72 views

Which Is the best tool for developing a virtual game? [closed]

Among the game development Tools like ,Unity, unreal engine ,Blender etc. I am going to develop a project on virtual reality based game for FYP(Final year project) kindly help me. Thank you.
0
votes
0answers
28 views

Textures go black when changing Quality Settings at runtime

Whenever I change my Quality Settings at runtime in editor mode or in build, all of my textures turn black. I use the following line to change the quality settings : ...
0
votes
2answers
61 views

Separating scene generation and scene starting in Unity?

I'm working on a game, where the map is generated, and: The map is generated in an Awake(), so when an object's Start() is called, the map should be fully initialized. But the scene's physics world ...
1
vote
0answers
19 views

How can I use Cross Platform Input in Unity 2019?

I am trying to use CrossPlatformInput in Unity 2019 to follow this tutorial to use it on iOS: https://www.youtube.com/watch?v=Auj1mrsfXDE However, I have no item in the top bar for "Mobile View" ...
0
votes
1answer
48 views

(Unity) Values set in Start() will be reset?

This is my GameController GameObject in the Inspector (Ignore Suns and Player). Note that ...
1
vote
1answer
38 views

Counter won't add to score

I'm trying to make a rolling ball game. But for some reason, I can't seem to get the counter to actually add to the score. Here's the code: ...
1
vote
1answer
54 views

Loop around a 2D Tile Map

I have made an algorithm for procedurally generating a 2D tile map in Unity. The player can use the mouse to pan the view and look at the map. My intention was that when the player reaches one of ...
0
votes
1answer
65 views

Unity build error “Value cannot be null. Parameter name: path1”

I'm getting this error when trying to build my game for Android, I've googled it but there's only 1 result about it and it didn't work for me as I use 64-bit windows. How can I fix this and what's ...
0
votes
0answers
16 views

Profiling Animator showing non-animation calls

When profiling using Unity, I have entries for PreLateUpdate.DirectorUpdateAnimationBegin PreLateUpdate.DirectorUpdateAnimationEnd however, digging down into ...
1
vote
2answers
82 views

How can I make a character crouch?

I tried to make a crouch system. In my script I changed .height and .center properties of collider in ...