We’re rewarding the question askers & reputations are being recalculated! Read more.

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

Run script after game start, before scene load

I'm making some kind of dependencies solving script. To work this script, it must be run before all other MonoBehaviour scripts. So I made the script something like this: ...
0
votes
0answers
34 views

Can I create new UI elements and use them from Unity?

I created the following class, that should be used to display numeric text in a UI canvas (score, lives, etc.): ...
0
votes
2answers
49 views

Center Gravity in Unity

a 2d planet in the center, where the players will be able to walk on it and also will be affected by center gravity. planet will be static and there won't be any other planets. so; Is there a way ...
1
vote
1answer
229 views

Inventory objects not persisting between scenes?

My Game Manager object has an Inventory script attached to it, which has "Don'tDestroyOnLoad(gameObject)" in its Awake function. During gameplay, items are pushed into a public List in this script. ...
-1
votes
2answers
22 views

Translate transform and RigidBody2d Addforce relative to world space

I'm developing a game with my friends from University. Currently, I'm in the process of creating a basic movement system for the main player with a box form as its mesh. I used transform.Translate to ...
0
votes
0answers
21 views

How can I plug a Unity application into native Android and native iOS?

There are a lot of questions about running native Android and iOS code in Unity. I am trying to run Unity inside of native Android and native iOS apps. My problem is that I have two native apps, and ...
0
votes
0answers
62 views

Preventing animated model from passing thru walls

I have a character model that has a sword swing animation where with every swing the character takes 1 step forward. This model has a capsule collider and a kinematic rigidbody and use a CapsuleCast ...
0
votes
0answers
9 views

How to add Collider to a Line Renderer in unity? [duplicate]

I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this. Current Code ...
1
vote
3answers
57 views

Why moving platform script is not working?

I have some code attached to a moving platform: ...
0
votes
1answer
20 views

Why boxCollider bound extents change when changing the size of an gameObject but doesnt in the script?

So, I have two players when I first made them they were with the default size Y = 1. After I finished the scripts I wanted to change their size but when I did that, ...
0
votes
2answers
69 views

Using enums for detecting object collisions

As far as I know, I can detect what objects the player is colliding with is by the following code: ...
0
votes
1answer
15 views

How do i implement a banner ad from mopub in my android unity app

I am new with unity and everything and I have made a simple game. I wanted to put a mopub banner ad on the game and i read this on their site. But I was wondering where should I put that code from the ...
0
votes
1answer
31 views

Unity 3D move kinematic rigidbody

I'm trying to move a kinematic rigidbody (a spaceship) with this code: ...
0
votes
1answer
38 views

How to make a follower script without diagonal movement

I’m working on a 2d game in unity. Right now I’m trying to make a follow ai. Where a character will follow the position of the player. I currently have it set it and working using the MoveTowards ...
1
vote
1answer
58 views

Adding a feedback survey to a game

So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would ...
0
votes
1answer
95 views

Unity3D - Camera Jitters When Displacing and Rotating Smoothly

DISCLAIMER: I am using Unity 5.6.5f1 for this code, I honestly don't know if there would be API updates on later versions, though I don't think so. I tried to make a simple Third Person Camera that ...
0
votes
0answers
33 views

What would be a good way to render individual meshes for a Tetris-like game in Unity?

I've been thinking of making a Tetris-like game in Unity3D, and I've looked at a few options to render several amounts of blocks in a matrix. I want to use the classic iterate-through-all-items-in-the-...
0
votes
1answer
41 views

Reading text from file changes the text?

I'm currently trying to load a simple text file and filter it by a certain string. In the text file I'm using a new line for each value and sometimes use a "--" to make things easier to read for me ...
0
votes
0answers
14 views

Object not clamping after applying force/impulse?

I am having issue with clamping the vertical position of my character after applying force. This causes a jittery effect in my character. There are other several ways I think of, but I dont know if ...
0
votes
1answer
43 views

How to handle forward/backward movement in an oblique top-down view

I'm making a pseudo-2D top-down game, where my assets are actually 3d but I use an orthographic projection to introduce more depth. I saw a picture of how the game "Enter the Gungeon" was actually ...
1
vote
0answers
14 views

Setting up Lightprobes

Moving around lightprobes requires using the movetool and all you really can do is move them along global axes and copy paste. There are no functions to scale, rotate, Snap to a surface, not even ...
0
votes
1answer
24 views

How to attach main camera to script component of a prefab?

So I have a prefab which is an item drop and a timer attached to the main camera. When the player collides with the item, I need the item to destroy then add time to the timer. The itemdrop handling ...
2
votes
2answers
78 views

Programming logic to 2D point and click adventure/puzzle?

I am totally new to game development. I want to create a 2D Puzzle/Adventure point and click game similar to like 'Rooms' but scenes are connected. I have already done the inventory system but ...
1
vote
0answers
32 views

Blurry background sprite, other sprites fine

Why is the background blurry, but all the other sprites fine? The background sprite has the same settings as the others. It's on the same Z position (0). It happened after I made some changes to the ...
0
votes
2answers
53 views

How to access the parent of a cloned prefab?

I have a menu that gets populated at runtime with buttons whose text components are based on objects that the game manager has in its databases. At the start, the menu is empty: See that "A" graphic? ...
0
votes
2answers
42 views

Unity - Save/load in a sandbox game, how to instantiate saved objects

I have a game where a player can place GameObjects. I can save/load this GameObjects data with using JSON, for example its position, but I cannot think of a good way to tell my save-file (and my ...
0
votes
1answer
19 views

Repeated nested game objects (UnityEngine.GameObject.gameObject)

I created a UnityEngine.GameObject and inspect its properties while in debug mode. GameObject obj = new GameObject(); When I ...
0
votes
1answer
36 views

How should I load/change/activate scenes?

Scenes are confusing the hell out of me and I'm pretty sure they should be simple to understand. When the game loads, only the current scene has a buildIndex != -1. In order give it a 'real' build ...
0
votes
1answer
15 views

Unity - Apply different Near/Far clip plane value for different layer

I am Lerping the Near value of my camera, from 0 to 38, and it gives this result: change near clip plane effect As you see, it gives a nice effect. But now I would like the effect to occur only for ...
0
votes
1answer
28 views

How do I make an object look at an angle in a top-down persepective?

Given a top-down persepective and lets say I know the angle I want to look at, how do I make a gameobject look into that angle? I currently have code like this: ...
0
votes
0answers
15 views

vector image is pixelates in game view

I imported a .PNG file at 1920 X 1080 resolution but it is pixelated in game view. I also tried as a .SVG file but it also gives same result. How can I fix it?
0
votes
1answer
22 views

Unexpected scaling of UI elements after build [Unity Web]

I have an unusual scaling of UI Elements after my build in unity for WebGL Game in Unity Engine: Game in Itch.io: Has anyone seen this kind of behaviour? any suggestions on what I should look into? ...
-2
votes
2answers
38 views

Want to stop instantiating objects when timescale is set to zero

I have my enemies being instantiated from both left and right sides and I've used Time.timescale=0; for the pause menu script so whenever i pause my game everything stop other than the instantiating ...
0
votes
0answers
36 views

How to erase the small gaps in tilemap in Unity?

I want to erase small gaps in my tilemap. The gaps look like this: The texture I used has no gaps: I tried by disabling anti aliasing.It didn't worked so what can I do in this case?
1
vote
0answers
21 views

Inconsistent CapsuleCast/Collision behavior when a GameObject is selected

My gameobject has a CapsuleCollider and I use CapsuleCast to check for horizontal collisions when moving horizontally so the gameobject won't pass thru obstacles. It works 100% of the time except ...
0
votes
1answer
42 views

Manipulating sprite shape rendered

I wish to create a game object where you can start dragging it by touching somewhere on the line of its collision and to create these "dynamic shapes" by stretching the sprites and readjusting the ...
1
vote
1answer
27 views

Load scenes inactive

When I call SceneManager.LoadScene() it will set the loaded scene as active. Can I load scenes at the game startup and just call ...
0
votes
1answer
30 views

Unity - character is not moving

What I'm trying to do I have a character - prefab. For this prefab I have one animation (idle), which works fine - I hit "Play" button and my character is in idle state. What I want is to try to move ...
3
votes
1answer
80 views

Selected enemy off camera

I'm facing a problem with a game I'm making. Currently I can select an enemy and mark it as shown on the image: But now I want to show the position of the selected enemy on the screen when it's off ...
3
votes
2answers
131 views

Is there a way to customize the Game-view Editor GUI?

I need to add a simple slider like scale slider in Game-view to change the timescale because I usually test my games by changing timescale.
0
votes
1answer
42 views

Detect collision on explosion

I am creating spells for my game. The collision with a normal fireball works just fine, what I am trying to achieve is to have the player_2 getting hit when the ...
3
votes
1answer
55 views

Why does the object rotate to a random direction when I start dragging?

I'm trying to do drag to rotate sort of thing, so far the code is fine. However when starting to drag (left clicking first), the object rotate to a random direction first which looks odd. here is my ...
0
votes
2answers
197 views

Creating 3D water on Unity for iOS/Android

I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling ...
0
votes
1answer
28 views

How to get position of next object that closest to player,when player is move forward to nearest every time?

I have a scene that looks like the following picture: The Player has a RigidBody2D and all the ...
0
votes
0answers
14 views

Do I have to write #pragma multi_compile_fwdbase in ShadeLab?

Recently I met a problem that if I don't write #pragma multi_compile_fwdbase then the shadows will never be shown. However, if I don't want shadows, it's ok without ...
0
votes
0answers
15 views

Blender-Unity (+ Lightmaps): Can I (should I?) have multiple UV maps for a single mesh?

I am making a game that I worry is not running optimally due to lots of high-res textures. The irony is that most scene assets use the same materials but I have to (do I?) unwrap the entire mesh on a ...
0
votes
1answer
61 views

Unity: White outline around seams in my character, make it stop!

so once upon a time I made a really cool character for my game project and he looked great. Then at some unspecific point in time, my character's UV seams got these awful white outlines around them: ...
1
vote
0answers
22 views

2D Rigidbody with Touchscript movement in Unity won't stay in boundaries

I'm trying to make a pong game where the player has to move both paddles. They are currently set as dynamic 2D Rigidbodies (collision detection continuous) and have a box collider (is NOT trigger) ...
0
votes
0answers
6 views

Set Unity to Fixed oculus sdk for testing

guys, I have been doing some VR development and I have noticed there are often times I want to test if something that relies on the Avatar is in or working but I only have a standing rift right now ...
0
votes
1answer
9 views

apk is fine, but when building aab for google play submission google play services dont start when i download it

So I have a game on app store, I added Google play services Now when I do an apk build and test it works great really happy with it. But when I then tick the box for aab ( this is what Google store ...