Skip to main content

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

I am testing the flyweight pattern on thousands of GameObjects but its not helping save memory. What am I doing wrong here?

I am trying to understand the flyweight pattern better by trying to optimize memory usage by spawning 10000 copies of an enemy GameObject that I have which has an Animator component, SpriteRenderer ...
mtg's user avatar
  • 1
0 votes
0 answers
9 views

Dualshock controller gives no input on android build

I want to create a 3D game for android, and move the first person character with a PlayStation 4 default controler (DualShock4). In the unity editor, I can move, look and jump freely how I want, ...
CheckerT's user avatar
0 votes
0 answers
16 views

FPS hands recoil

I am working on FPS game. I have created few animations in blender.I started working on weapon shooting and understood that for that one I need procedural recoil.I created a script that generates ...
Taras Fityo's user avatar
1 vote
0 answers
15 views

Finding objects with tags vs Layers vs Scripts in Unity?

I never know which one I should use. If a bullet flies towards a target, let's say a zombie, should the Zombie have a tag? Maybe an "enemy" tag, or "Damage" tag? Or should I look ...
MrV's user avatar
  • 47
1 vote
1 answer
42 views

How to structure a complex inventory system in Unity?

My inventory needs to deal with different Item types. Item is my base class, which is extended by Armor, Weapon, Spell, Scroll and I might add more in the future. All items have an interaction on ...
Pascal Claes's user avatar
0 votes
0 answers
23 views

How to filter/ignore child objects from an ML Agents RayPerceptionSensor in 3D?

I am making a snake AI with Unity ML Agents. There will be lots of snakes who will eat and dodge each other. A 3D RayPerceptionSensor detects everything, but there is a specific case where a problem ...
Ujjawal Saini's user avatar
0 votes
0 answers
20 views

Calculating hemisphere points of a scaled capsule2D

I have a very simple code that draws the shape of a pre-defined capsule. It handles everything well, except the case when GameObject to which CapsuleCollider2D is attached or any parent GameObject up ...
Digika's user avatar
  • 1
0 votes
0 answers
25 views

What is the best way to load UI Document file?

I have a UI document file at Assets/CustomWindow/Editor/CustomWindowFiles/CustomWindowVisualTree.uxml and I need to import it into my custom window editor script. I ...
Ahmed Dyaa's user avatar
0 votes
0 answers
38 views

How to make the character selection screen? [duplicate]

Hi to everyone i want to make the character selection screen the following 2 are scripts ...
Jano Wazir's user avatar
0 votes
1 answer
65 views

How to efficiently instantiate large amount of GameObject?

The topic with the same title here How to efficiently spawn & render many cube prefabs for a voxel world? is actually asking about efficiently rendering. Assume I need to instantiate a lot of ...
Suratraak's user avatar
7 votes
1 answer
1k views

What is the meaning of green plus icons in component headers?

Some components have these green plus icons. Some don't. What does it mean?
Zen Of Kursat's user avatar
0 votes
1 answer
38 views

Prevent rotation after setting Human Pose

I'm attempting to move the fingers of a prefab using muscles with the SetHumanPose method. However, the prefab is rotated 90 degrees on each call to ...
wrappingduke's user avatar
0 votes
0 answers
32 views

Best Unity Multiplayer Tool for 70+ units? [closed]

I am making a game that combines Brawl Stars and Survivor.io and i plan to have 2 - 6 players on the map with additional PC units (up to 100 at max). There will be around passive 20-40 abilities ...
DejanRadoman00's user avatar
-3 votes
1 answer
86 views

Character selection screen to choose what character loads in next scene

I am working on the character selection screen for my game. I want it so that, when the player clicks on the select button, the code checks if the imagecollection ...
Jano Wazir's user avatar
0 votes
1 answer
51 views

Is a conditional compilation directive needed to ensure editor script is not compiled into build?

Should an editor script contain #if UNITY_EDITOR to get excluded from build for Android and iOS? If so, where it should be written: ...
Ahmed Dyaa's user avatar
3 votes
1 answer
46 views
+50

Load a Single Sprite using Addressables

I've been dabbling with Addressables for a while, and overall everything works fine with AssetReferenceT - I can load Textures and just about anything else, but for ...
Saturn's user avatar
  • 1,751
0 votes
0 answers
40 views

Code working with only 1 game object instead of 2

So im creating a tcg, where you currently control both players. Im in process of adding drawing cards, which i do with right click in here ...
Svak's user avatar
  • 1
0 votes
1 answer
29 views

Cannot read value of type 'Vector3' error in Input System package

I'm a Unity newbie. This time, I'm trying to make the Player operable with an Xbox controller using PlayerInput. However, when I control the player, I get these errors: Errors that occurred: [20:35:...
Wazuku's user avatar
  • 1
0 votes
0 answers
27 views

Books/Videos to level up C#/Unity knowledge [closed]

Unity and C# is my first programming language and game engine and I have come to a part where I dont know what to do next. I know the basics of both C# and Unity, and also quite a few "Advanced&...
MrV's user avatar
  • 47
-2 votes
1 answer
69 views

Object refrence not set to an instance of an object

For some reason, the Unity console shows an "Object reference not set to an instance of an object error" when I run this line of code: ...
Jano Wazir's user avatar
3 votes
0 answers
29 views

How can I set the asset icon of a ScriptableObject depending on its properties?

I want to set an icon for scriptable-object according to it's properties. I succeeded, but the end result was not what I wanted. I used RenderStaticPreview in it's ...
Ahmed Dyaa's user avatar
0 votes
0 answers
11 views

how to label parts of an imported Maya model in Unity

I want to import the model you see in the picture to Unity. Now, my goal is to create a script that will remove part of the at random. So, in the picture I can place two doors in the red areas. But, ...
i_o's user avatar
  • 101
0 votes
1 answer
33 views

In Unity, how can a regular RigidBody know if it collided with a CharacterController?

I have a Unity CharacterController, that can detect collisions using the following code: ...
Kokodoko's user avatar
  • 105
1 vote
1 answer
40 views

Visual Effects Experimental Block

Currently I am using Unity version 2022.3.12f1, and I have downloaded the Visual Effects Graph from the package manager (Version 14.0.9). From what I can see from other people's VFX tutorials, they ...
rck's user avatar
  • 11
0 votes
1 answer
58 views

Moving prefab body parts up and down — stops working when tied to a button click

I'm newbie to Unity and attempting to move a prefab's arm up and down on a button click but having some difficulty. The arm movement works when called from the Update() method without checking for a ...
wrappingduke's user avatar
0 votes
1 answer
18 views

Selective Transparent Layer or GameObject is opaque except for certain type(?) of GameObject

Is it possible to create a transparent material that is only transparent to a certain other material or objects on a layer? For example MaterialX is opaque to all materials except to MaterialY or ...
ina's user avatar
  • 294
0 votes
2 answers
82 views

Why can't I find GUID that failed to register in the dictionary?

In Unity I encountered an error : "ArgumentException: An item with the same key has already been added. Key: c1b4c30c-7675-4940-8bab-31b514fbc818" I want to find component with that GUID key ...
NationalGeographicProgrammer's user avatar
3 votes
1 answer
2k views

How are GameManagers created in Unity?

I know the basics of C#(Syntax, 4 pillars, SOLID, Designs Patterns, etc...) and Unity. I can do basic stuff like Flappy bird or Fruit Ninja without any help. But problems arises when I want to create ...
MrV's user avatar
  • 47
0 votes
0 answers
78 views

How to protect Unity C# variables from TRIVIAL memory hack attempts?

DISCLAIMER: I am not trying to prevent all hacking. I am simple trying to make it a bit harder for beginners who watched 1 or 2 Cheat Engine tutorials to hack my game. I am aware it is impossible to ...
Pascal Claes's user avatar
0 votes
0 answers
25 views

Creating ScriptableObject through script

I need to create a ScriptableObject through script, So I used AssetDatabase.CreateAsset but it creates inside project folders only. So is there a way to create the ...
Ahmed Dyaa's user avatar
0 votes
2 answers
58 views

Limiting number of Game Object

So I have this script that summons a stationary laser that the player is supposed to not get hit by, but since there's multiple game object with the code and they can all trigger at making it ...
Matt Sou's user avatar
0 votes
0 answers
27 views

UI Toolkit event doesn't let me finish writing the value

I use an integer field to indicate the value of the wanted year and I set a maximum and minimum limit for it and I wanted a function to be called when the wanted year value changes to display the ...
Ahmed Dyaa's user avatar
0 votes
1 answer
31 views

Collectible effect with particles

I want to make a coin/star collectible effect like when you beat a level in the game Geometry Dash. There, the stars all fall from a pre-defined place in random directions, and after about 1 second of ...
CheckerT's user avatar
0 votes
0 answers
31 views

Unity Rigidbody.AddForce stops adding force when there are too many objects in scene

As title stated, when there is too many objects in scene (made when a turret object in my scene shoots too many bullets, they do despawn after a duration so its not completely clogging my scene) my ...
user3602367's user avatar
1 vote
0 answers
40 views

Minimal Content-Security-Policy (CSP) for WebGL Builds

I have a Webgl build created in Unity 2020.3.22f1. The Content Policy looks like this (set to report-only for debugging): Code (htaccess): ...
TheCell's user avatar
  • 103
0 votes
0 answers
73 views

How can I override the directional light processed by a shader?

I'm building a solar system and have made the simplifying assumption that the sun will always be at 0,0,0. Rather than worry about "real" lighting, my planet shader just works out where it ...
Basic's user avatar
  • 1,228
0 votes
0 answers
12 views

In Unity, how to make World Space XR UI Canvas Scale with the Child Input Field TMP?

I have an XR UI canvas that is set to World Space. It has a child object which is an Input Field. If the text input overflows the Input field, I have made it to expand vertically downwards using a '...
Amir's user avatar
  • 31
1 vote
1 answer
54 views

Do editor scripts impact game performance?

Do Editor scripts or custom editor windows with UIToolkit have an effect on game or engine performance? Even after build? Do they get built with the game when exporting it?
Ahmed Dyaa's user avatar
0 votes
1 answer
31 views

When is Time.fixedDeltaTime used in fixedUpdate?

Most of the time when I use FixedUpdate I dont add Time.fixedDeltaTime, but is that something I should do? Because we have Time.deltaTime in Update which is for making sure that your game runs frame ...
MrV's user avatar
  • 47
0 votes
1 answer
42 views

Secure the URL link?

I'm trying to use a cloud to save & load my data. It's working, but the URL link is readable. Is there a way to hide/secure it after exporting the game?
user43474's user avatar
  • 537
0 votes
1 answer
33 views

How to minimize cost of drawing 1-2 objects while keeping them bright enough to see?

I have a really simple scene that includes only one or two 3D objects, and the rest of it is UI. My target is WebGL so I am taking every chance to optimize thing as much as possible. The game objects ...
Ivan's user avatar
  • 349
0 votes
0 answers
37 views

Hide objects behind invisible wall

I am developing a VR application in Unity where I have a 3D object (a plane) flying over the player's head. I am using a Skybox for the background and I want to make the plane "disappear" ...
Sergiu Priboi's user avatar
-1 votes
0 answers
23 views

My saving in json format works in the editor, but it doesn't work in android [duplicate]

While making a game in Unity, saving in json format works as I want in the editor, but it does not work in Android. Where am I making a mistake? The code below is the script in which I wrote the ...
Volkan AKDAG's user avatar
0 votes
1 answer
27 views

How to make this Triplanar Shader Graph follow object rotation

I have what is essentially a double triplanar shader. The first triplanar is a base rock texture, and the second triplanar is going to be an accent texture, such as grass, sand, etc, which is always ...
Krythic's user avatar
  • 790
1 vote
1 answer
55 views

Correct way to manage managers and controllers in Unity

I am having a bit of a headache right now about my controllers: Ive got a bunch of managers in my game, for example A MasterController to manage most serious stuff like pausing or turning off input ...
fastbyte22's user avatar
0 votes
1 answer
102 views

Adding 1 million torque to a normal cube won't make it rotate extremely fast?

In Unity, I have a normal cube with a rigidbody component. I'm listening to keyboard input and calling AddTorque with extremely high values when a key is pressed. ...
kyopa's user avatar
  • 133
0 votes
1 answer
94 views

Randomized bullet shooting bullet hell

So I'm making a bullet hell game and I have script for a basic bullet to spawn and shoot towards the player, but it's always at set intervals and I want it to be random, but I dont know how. I tried ...
Matt Sou's user avatar
0 votes
0 answers
25 views

What are the consequences of using AfterRenderingTransparent for grass?

I followed a tutorial for unity URP stencil to hide objects, I want to use it to hide terrain grass under objects like vehicles, houses, etc.. The tutorial says to create 2 layers, and create render ...
John Smith's user avatar
  • 1,255
1 vote
1 answer
44 views

Object moves continuously and won't stop until it hits an obstacle

So im fairly new to coding and don't know much and so I decide to improve this line of code I had before, by finding something online and now my object is constantly moving and won't stop unless it ...
Matt Sou's user avatar
0 votes
0 answers
15 views

I can't bake the light in Unity [duplicate]

I want to bake the light in my game scene in Unity and it shows for 3 days. Where am I going wrong that I can't bake the light? In the past, I would create both shadow and light by rotating the light ...
Volkan AKDAG's user avatar

1
2 3 4 5
331