Questions tagged [c#]

C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform.

Filter by
Sorted by
Tagged with
0 votes
2 answers
39 views

Testing player preferences in unity

I have a section of a script that is pretty simple and works but I am wondering the best way to rewrite it to be testable. ...
user avatar
  • 137
0 votes
0 answers
31 views

How to make my player stick to platform when the collide and unstick when jump button is clicked?

I am making a game where player jump to the platform and stick and when jump button is pressed it jumps again. please help me .Thank you
user avatar
0 votes
1 answer
30 views

Why when the transform position and the radius position is the same it keep changing the transform position?

...
user avatar
0 votes
1 answer
43 views

How do I use version controls for teams?

I have a question and I haven't found a topic, which fits it. I want to create a small mobile game and I plan to work on it with some friends later on. Do you guys have any tips for me how I can use ...
user avatar
0 votes
1 answer
82 views

Creating Dictionary from JSON file

...
user avatar
  • 654
0 votes
1 answer
152 views

JsonUtility deserializes list of strings, but all strings come out empty [closed]

What I have JSON file ...
user avatar
  • 654
1 vote
2 answers
738 views

how do i NOT let this object spawn at a certain area?

...
user avatar
0 votes
1 answer
47 views

Anyone about me how we make games in Android , also about me can we use c# or c++ in blender [closed]

game development in blender with c# hello everyone about me c# coding for games in blender game engine how i can use blender in Android because i'm new student in game developement Also about me how ...
user avatar
1 vote
1 answer
62 views

Predictive Aiming To Update Every Frame

I am making a 2D bow and arrow game, and I want there to be a predictive aiming line as you pull the bow back. The problem is, in my current script, it seems to only update every time I go to shoot, ...
user avatar
0 votes
1 answer
40 views

Creating variable with the name from user

I'm not sure this is possible or not but I need to create a variable and set its name to whatever the user wants. Is this doable in C#? something like this is what I want: ...
user avatar
  • 654
0 votes
0 answers
24 views

How can I activate one of the objects in the GO array and deactivate the previous one?

I am creating a car color change mode. In the prefab, I auto-created several Primary game objects, which are added according to the material responsible for a specific color. The prefab of the car is ...
user avatar
0 votes
1 answer
66 views

How to look up items by name in lists loaded from JSON data?

I'm using a JSON file for loading texts and dialogs and here's my JSON file: ...
user avatar
  • 654
0 votes
1 answer
29 views

Unity2D predictive bow aiming using object array only displaying vertically

I am making a bow and arrow game in Unity2D, and I want to use an Angry Birds style predictive aiming system(like in this image https://i.stack.imgur.com/A6Jqy.png). I have loosely followed a tutorial,...
user avatar
0 votes
0 answers
26 views

Why the script is adding same object with same tag twice to the List and different positions?

The script should let the player shoot bullets either manual or automatic by pressing the mouse left button for single shot and right mouse button for automatic fire. The problems : In my scene i ...
user avatar
1 vote
1 answer
34 views

change camera angle in unity2d

I am creating a 2d top-down game in Unity where you can press a button and the camera will cycle into different angles, mainly forward, backward, left & right. I have gotten the cycle to work by ...
user avatar
0 votes
0 answers
44 views

Expected memory layout of 3D textures

I'm writing a texture viewer application which up until now supported 2D as well as 2D array textures. Recently I wanted to add support for some volumetric 3D textures that I stumbled upon but I am ...
user avatar
  • 204
1 vote
1 answer
45 views

Gameobject is moving even though I only rotated it

Ok, this problem is kinda hard to explain, but I have this mouselook script as follows: ...
user avatar
0 votes
1 answer
84 views

Default ScriptableObject inspector duplicates on every ListView onSelectionChange

I'm creating some sort of database editor window, and one of the things I needed to do was show the default inspector for the currently selected scriptable object. It was a bit complicated to achieve ...
user avatar
0 votes
0 answers
354 views

ArgumentException: An item with the same key has already been added: UnityEditor.Scripting.ScriptCompilation.ScriptAssembly

...
user avatar
0 votes
0 answers
64 views

Moving Object "in or out" along the z axis using Sin(time) or Cos(time)

I am new to game development, and I have successfully moved an object in the x and y directions using Mathf.Sin(x) and Mathf.Cos(x). But I'm unable to move same object in the z-direction (in or out). ...
user avatar
  • 1
0 votes
1 answer
83 views

An issue that could be either serialization, or Unity's SceneManager

At this point, I don't have any idea of what could the issue be. So, I was trying to make a project wide loading screen. Through an editor window, I assigned the loading scene, which was picked up via ...
user avatar
0 votes
1 answer
129 views

Generating UVs for an annular sector/ wedge-shaped procedural mesh

I am using code to generate a mesh to show the firing arcs for a tabletop-style game I am working on. But when applying a material to it, I only get a solid color. Here you can see the custom mesh ...
user avatar
0 votes
1 answer
23 views

Floating Health Bar Not Displaying Correctly

Currently working on an overhead display of the health bar and ran into this problem and I cannot seem to figure out why its not working correctly. When the player has less than ...
user avatar
0 votes
1 answer
41 views

Architecture advice: a combo manager with combo displayed on the GUI in Unity

I would like some advice on the architecture I am using, and if there's perhaps a better way to go about doing this / if I am over-complicating things. I have a combo meter go up on the screen based ...
user avatar
0 votes
0 answers
35 views

Moving Camera with script

Hey all I am trying to make a scene where the player is experiencing a plane crash however when I try and move the camera with transform. Translate the camera is not moving. The plane moves along as ...
user avatar
  • 137
0 votes
0 answers
15 views

simple button color change

Hello i want to create a simple button that activates on a click but my code wont activate and I've tried an print plus a color change of the sprite but none of these worked, the button is a image ...
user avatar
0 votes
2 answers
55 views

Why coroutine gets stopped?

Here's my code: ...
user avatar
  • 654
2 votes
2 answers
89 views

Understanding use of "localUp" in planet mesh generation code

I'm following a tutorial on YouTube about procedural generation of planets. I'm puzzled in some aspects of the code shown. If any of you could explain the following points, I would be very pleased. ...
user avatar
-1 votes
1 answer
139 views

Why am I getting this " Object reference not set to an instance of an object" error [duplicate]

...
user avatar
1 vote
1 answer
81 views

Forcing animations to play in real time, ignoring time scale

When the character dies, an animation plays, and then the scene resets. What I want is that nothing moves/animates except the character and the life bar so I use ...
user avatar
  • 654
0 votes
0 answers
46 views

Is there a better way to implement a 2D Rail System?

Hello I wanted to ask how do I implement a functioning grinding system on rails in a 2D Game. I had the Idea of jumping onto a box collider and using the trigger position as the starting position and ...
user avatar
  • 141
2 votes
2 answers
81 views

Ways to synchronize lists over the network?

Im working on a little plain c# gameserver using an ecs. It follows the principles of the client/server model architecture. However im often running into the following problem, the server has one or ...
user avatar
  • 483
-1 votes
1 answer
105 views

My object didnt "dash" on a new Input system. I have put in a code but didn't work

...
user avatar
0 votes
1 answer
87 views

Script not working on object in unity 2D

I was following a tutorial where the gameobject was to spawn randomly within the screen. The code I used is as follows. ...
user avatar
0 votes
0 answers
16 views

Is there a lighter way to implement "object stops when hit wall" without relying on Dynamic gameobjects in Unity3D (2D)?

I am currently using a Dynamic GameObject for my entities, but I feel as if that will risk slowing down the game on weaker hardware (especially when there are hundreds of entities). Not only that, but ...
user avatar
  • 1
0 votes
1 answer
39 views

Why the transform is not moving to the target form it's current position?

When the transform is start moving it's like "jumping" to a position near the position it is now and start moving from that position and not the position the transform is currently at. It ...
user avatar
0 votes
2 answers
107 views

Determine line that threw an Exception using Android Logcat

I just installed Android logcat to debug my game from Unity's package manager. I don't fully understand how it works or in what order the logs are shown relative to my code. The problem I have is that ...
user avatar
0 votes
0 answers
31 views

Can't use SRWorks SDK for HTC VIVE Pro Eye – compile error on importing the package

The SRWorks SDK is used to create mixed reality with HTC VIVE headsets. I downloaded the latest release from the official site. When I import Vive-SRWorks-Unity-Plugin.unitypackage, the editor throws ...
user avatar
0 votes
0 answers
35 views

Problem with drawing on texture

I'm trying to do a simple stretch-card erase effect. Everything works on the PC (both in the editor and in the build). But when I make a build for android, something goes wrong. Pc Version (work vell):...
user avatar
0 votes
1 answer
67 views

Move object from one position to another considering the colliders

I want to move object from one position to another but with one exception that the object should adjust its path according to colliders. The object is free to fly so it should consider colliders in ...
user avatar
0 votes
2 answers
45 views

Unity object won't look at target

I have a box in Unity that I want to turn to face in a direction. I tried to use Transform.lookAt() and Transform.rotation but ...
user avatar
0 votes
1 answer
102 views

Dash Cool Down Problem Unity2D

I need help in adding a cooldown feature to my dash ability. I tried to look online for solutions, but when I add it into my script, the dash does not work anymore. I would appreciate some help as I ...
user avatar
  • 1
0 votes
1 answer
47 views

Control different speeds for moving left/right, and facing that direction

I have a game idea... and I need a script where I can control the speed for moving left, and control another speed for moving right. But, I also need to let my player face that direction. ...
user avatar
0 votes
1 answer
164 views

How to rotate parent and all children by center pivot?

I have a DoorSprite with an Animator component which I animate by rotating it by 90 degrees (makes the door look like opening ...
user avatar
0 votes
1 answer
48 views

Facing Arrow on right direction while launch

Hey guys I've been making a bow and arrow system. I'm stuck on making an arrow facing the right direction before its launch. I've attached 3 arrow prefabs in the right position of the player's hand ...
user avatar
  • 1
0 votes
1 answer
241 views

Why is button component's animation transition just working for some buttons?

I have a main menu scene in which the buttons work using button component's animation transition. I created a simple animation for them that changes their vertex color to blue when selected. The ...
user avatar
  • 71
-1 votes
2 answers
142 views

Lerp Teleporting In Unity

I am trying to make a object move back and fourth but its teleporting instead of moving smoothly. This is my code. ...
user avatar
  • 1
1 vote
0 answers
34 views

How to properly replace an input action in unitys input system

I'm currently running into some unintended behaviour when using Unity's input system. I currently have a state machine for my player controls, so theres a move state, dash state, wall slide state and ...
user avatar
0 votes
0 answers
39 views

Get all the objects which are involved in a collision (exactly) in Unity with C#

How can I get exactly all objects which are involved in a collision? The objects which collide in my case containing of several childobjects from which I need to know which of the childobjects is ...
user avatar
0 votes
0 answers
26 views

How to move an object that have linerenderer component?

I mean to move only the object without the linerenderer. The script is attached to a 3d cube and draw a circle around the cube. but when I try to drag the cube around also the circle of the ...
user avatar

1
3 4
5
6 7
159