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
0
votes
0answers
7 views

Null reference on gameObject that has been successfully referenced

It's exactly as the title says. I am getting a null reference error even though I have properly referenced the object. I have debugged my code to show that the result is always exactly what I need ...
0
votes
2answers
214 views

Dragging a Rigidbody2D without passing through obstacles

I have this body of code written for an object that needs to be an obstacle and another object that is draggable. I have colliders on both and a kinematic rigidbody on the draggable object, but the ...
0
votes
0answers
9 views

GA Measurement Protocol without Firebase

I was successfully using Measurement Protocol for my websites and web apps to gather analytics data. Now I'm trying to implement it in my game, but nothing happens. Debug url gives a valid response: ...
0
votes
0answers
15 views

why does Physics.Raycast always return my player game object instead of the object I clicked?

I have 3D world. I want to detect when the player clicks on a game object in the world. In this image, I have 2 objects I want to detect mouse click on. The white sphere does have collider on it. The ...
0
votes
0answers
12 views

The children of a Transform are in reverse order

I am making a simple 4-player turn-based card game. At one point, a player can "open" his hand on the table. As the player does this, I want cards to be aligned in a way such that left side of each ...
1
vote
1answer
62 views

How can I control ads frequency?

This question was already asked a while ago, and I wanted to check the present situation: Can I control ads frequency from the dashboard? (e.g. frequency capping in Admob) Can I control ads frequency ...
0
votes
0answers
6 views

How to Enable canvas with Event during a animation clip

I want to enable a canvas while an animation clip is playing, I used animation Event and call the following script to enable the canvas, but the editor does not recognize any game object. How a ...
0
votes
1answer
49 views

Moving my character/camera makes environnement jerky

I'm learning to make a Tilebased game with Unity and for that I use the Zelda alttp assets. I just have Tiles, a Camera and a moving Character with a rigidbody2D and a CircleCollider. When the Camera ...
0
votes
0answers
14 views

Isometric Z-as-Y Sort Order issue in Unity

I'm struggling with isometric Z-as-Y tilemap sort order in Unity. I'm attempting to paint two layers of tiles into my tilemap. When I add tiles that I would expect to show "below" / "behind" my upper ...
0
votes
1answer
29 views
0
votes
1answer
792 views

Why is my spherecast returning an incorrect hit on mesh collider?

I have a mesh collider that is largely a flat plane facing up. Any SphereCast against that surface should return a normal of Vector3(0, 1, 0), but that isn't always happening. When near an edge on the ...
-1
votes
2answers
21 views

Unity: RigidBody2D, Trying to Set rb;

So for Unity I've been trying to to do the code line public RigidBody2D rb; I've followed the gmetrix unity programming course and they do that just fine with the ...
0
votes
1answer
10k views

How can I fix “the referenced script on this Behaviour is missing” warnings?

One of my game objects used to have a script that I have now deleted on purpose. Now it keeps saying this message as a warning: The referenced script on this Behaviour is missing! How can I rid of ...
0
votes
1answer
72 views

How can I gradually increase the speed of my game?

I recently made a replica of (Dino run) game in Unity2d. But I'm stuck on how can I speed up my game gradually. Should the game speed be increased or should I increase the speed of the camera. ...
0
votes
0answers
13 views

My platform disappears

Hello, I am having a problem right now. I can't seem to understand what this code does because I just copied this from someone, but my problem is my platform is disappearing when every time it almost ...
0
votes
0answers
17 views

Vertical push doesn't let the object fall down instantly [UNITY]

An object (Wall) is continuously moving forward on the X axis with a simple script: ...
0
votes
0answers
12 views

SetTextureOffset in meter per seconds speed

I have this code snippet that faking the tiling offset speed. Now i want to set the speed in terms of meter per seoconds. how to divide or multiply that i get a number which is meter per seconds: <...
0
votes
1answer
2k views

How to use a .mtl file in Unity?

I want to use a .mtl file to draw my objects in unity. Can I somehow convert a .mtl file into a normal Unity material? My .mtl file is like this: ...
0
votes
1answer
19 views

How to reset an incremental achievement in Googles Android API?

For example the achievement is "Pass 5 levels in a row without failing" It's incremental and has five steps. If a user hits an obstacle, this achievements score should obviously be resetted to 0. ...
0
votes
2answers
19 views

Unity 2D Tiles disappearing when i zoom in

All my tiles/sprites have 0 as their position on the Z axis, except my main cam which has -10. For some reason i suddenly couldn't zoom in without everything disappearing, I switched to 3D view to ...
0
votes
0answers
22 views

Implementing counter-steering for a drifting car in 2D

I could make a sliding car. but i want the counter steer functionality. My current model of the car has 4 wheels, all of them have a script handling the slip. am currently multiplying the side ways ...
0
votes
0answers
26 views

Using a Bluno beetle instead of Arduino Uno

So I am making an interactive game using Unity and an Arduino Uno. However, I now want to migrate my Arduino project onto a Bluno Beetle board. I am using the following code on Unity: ...
0
votes
1answer
31 views

How to add force on an object when it landed on the ground?

when i add the force it jumps up and disappear after pressing the up key.I want it should addForce only when it is on the ground position.
0
votes
0answers
21 views

Not able to move quad wheel robot

I am trying to move QWAD wheel robot, I have grouped the wheels separately and added wheels colliders for each wheel. The problem is that the wheels are moving but the robot is stationary. I have been ...
0
votes
1answer
47 views

How to place a camera so that it always fits a plane?

I have a plane that can get its scale changed during the game, and I want to make the camera view it completely every time the plane has its scale changed. The only camera is set to perspective ...
0
votes
0answers
24 views

Can I rely on a Navmesh for X/Z movement and manually place my agent on the Y axis?

I'm generating my terrain mesh around the player (along with collision mesh and Navmesh). It's tile based, when the player moved enough I generate necessary tiles render meshes, then collision meshes ...
1
vote
2answers
80 views
+50

How to build only specified assets into assetbundle in unity

I have searched through the few results pertaining to this particular question, but haven't found any results that work. A simple rundown of what i am looking for is to be able to make a single asset ...
0
votes
1answer
24 views

How to Bring the Scene View Camera Controls into Game View

I've got a scene with a big sphere in the centre (the Earth) and a lot of smaller spheres around (the stars). Above is a screengrab in Scene View with the camera in the Front View position. I really ...
0
votes
0answers
48 views

Enemy pick a player?

I'm trying to make my enemy pick a player from array that no enemy around him. "Around_player" it tells me how many enemies around player.Also, bool "PlayerSurrounded" tell me if enemies around player ...
0
votes
1answer
18 views

Unity Dropdown Stays Stuck Open

As can be seen in the following video: https://youtu.be/zb3uMUqub00 The dropdown stays stuck open when Unity launches the game. This happens even with a non-modified dropdown that is plopped as a ...
1
vote
1answer
95 views

How to stop my cube collider when it hits another collider using Transform.Translate?

As we know, Transform.Translate() ignores collisions. What functionality do I need to add to my code so that when my collider hits something, the physics system ...
1
vote
1answer
74 views

How do I properly change the value of a prefab'd instance variable?

I am currently following a tutorial on how to make a 2D platformer in Unity. The tutorial explains how to make an enemy wave spawner, but it doesn't explain how to make enemies stronger after I have ...
0
votes
1answer
71 views

Unity3D - weird model imported from blender

Also it's important to mention that I'm using LightweightPipelineAsset for Scriptable Render Pipeline (so I can use PBR graphs) Problem is that surfaces that SHOULD be drawn they AREN'T and the ones ...
0
votes
1answer
23 views

Unity detect tap on object or area with Raycast turned off on the object

I have a large dial which can be rotated by touch. I have a circular crosshairs at the top to show which number is selected. I have had to turnoff the Raycast Target...
0
votes
0answers
28 views

Why isn't OnCollisionEnter being called?

I have a hammer and an object to be hit in my scene. I put this line Debug.Log("Collided with" + collision.gameObject.name); to debug whether the function ...
0
votes
1answer
20 views

Pivot not updating programmatically

I have a canvas. It has an empty game object as a child. That object has a RectTransform component. The RectTransform pivot value is set to 0.4, 0.5 (x, y). In some code I wanted to update the ...
3
votes
1answer
276 views

Why are assets (images) in Unity build reported as 28 times larger

I'm trying to reduce a Unity WebGL build size which, for the data asset, is currently at 30 Mb. I installed the Build report inspector. On clicking the "Source assets" tab and choosing "Size" it ...
0
votes
0answers
31 views

How to stop background audio upon collision [closed]

I have a basic 2D game and have added some music in the background that plays on a loop. When my player collides with an object another sound plays to indicate that the object has been hit. How ...
0
votes
1answer
106 views

How can I detect whether a point is moving in a circle?

I want to detect if my GameObject (Vector3 Point) being dragged by the player's finger is moving in a circular fashion. I thought I could save the last 5 points ...
0
votes
1answer
78 views

Making 2 Player UI

For practice, I'm trying to remake the character select screen from Street Fighter II. I managed get it working with a Grid Layout Group, ScriptableObjects, and some scripts to have the 1P cursor ...
1
vote
1answer
20 views

How can I reference classes from my scripts in my unit tests?

Bit of a noob question, but I'm having trouble getting unit testing working in Unity. I created a PlayMode test assembly, I toggled "Enable playmode tests for all assemblies" as directed in the manual,...
0
votes
1answer
13 views

Unity BoxCollider2D causes motion to be exponentially multiplied

I have a player and an enemy square for my 2D game (technically it's a cube, but it's rendered as a 2D character). I have a RigidBody2D attached to the player and the enemy each, along with a ...
0
votes
1answer
51 views

How can I keep track of which “rooms” characters and NPCs are in?

I have a Unity 2D project which has a player character and numerous NPCs all potentially moving (top-down) at the same time during play. The number of NPCs is not to exceed 100 (and will be, probably, ...
0
votes
0answers
30 views

How do I make a Transform object follow it's parents rotation

So basically i have a transform object parented to a gun. I use this transform to determine the position my bullets are spawned in, and their rotation. The position part of it works fine, but the ...
0
votes
1answer
103 views

SetIKHintPosition and SetIKHintPositionWeight seems to have no impact

I have recently been exploring Unity's inverse kinematics, to further polish the interaction between our rigged avatars and props. I have made a sample project, using PuppetMaster's basic humanoid ...
0
votes
1answer
39 views

The camera does not capture movements in z-axis

I want to make a simple drag and drop card in Unity, where the card pops up a bit towards the screen when the drag begins (lifting effect), and then drops down back on the table when the drag ends. ...
0
votes
1answer
54 views

Setting vertex colors for a marching cubes mesh

I am making a voxel based terrain system (Yes, I know, very original...), anyway... Each voxel should have it's own color so the player can distinguish which type of material it is. For example: dirt ...
0
votes
1answer
43 views

How do I get the size of a Plane in pixels and set it multiplied by some factor to be the size of a Sphere?

I am doing an attempt to make a 3D snake game, as an experiment but I am still a beginner. I have a Sphere that I wish to dynamically resize to be, let's say, the ...
0
votes
1answer
48 views

How to create video from camera?

I have a 3d scene and a camera; I want to create video file from camera pre-set movements. If it is possible, running application by command line (without needed to "show" at video, my camera) . Is ...