Skip to main content

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

First person jump only works at certain angles

I'm making a basic 3D First Person project using the movement code below, but I can only jump at a certain angle. How can I fix this so that my character can jump anywhere? ...
MarsDarklighter's user avatar
2 votes
0 answers
151 views

How to paint terrain details (e.g. grass billboards) programmatically?

In Unity, is it possible to paint terrain details such as billboarded grass textures programmatically? (The kind that appear vertical and wave according to wind settings.) What I know so far (or think ...
ChurlishCanadian's user avatar
0 votes
1 answer
75 views

Weapon flips upside down when aiming to the left

When the player turns to the left, the texture of the weapon turns upside down. How can I solve this? Shooting Script ...
Lekr01d's user avatar
0 votes
0 answers
180 views

How do I copy GPU buffers in Godot like in Unity?

How would I convert even a section of the following code, which was taken from this GitHub Source to Godot C# or GDScript? I'm trying to make a Godot version of this project, but I don't know how to ...
Ethan's user avatar
  • 145
0 votes
0 answers
33 views

Live notifications using PlayFab

I want to integrate live notification, send/receive, in my Unity game using the PlayFab server. Is there an API call for this?
zaboombafoo's user avatar
0 votes
1 answer
46 views

Game object ownership not transferring and getting destroyed with the master client

I'm using photon pun. I have a spawner script which instantiates the eatables in the gameplay and right after the instantiation, im transferring its ownership to null. The instantiated game objects's ...
zaboombafoo's user avatar
0 votes
1 answer
252 views

Clicking UI button calls event twice

I've designed a game where, when a button is clicked, the moving point stops. If the button is clicked again, the moving point starts moving again. I only click on the button once, but the ...
Alisa's user avatar
  • 1
0 votes
1 answer
107 views

Why can't I press buttons after re-enabling the UIDocument?

I have this UI with buttons that should be clickable whenever the UIDocument is enabled, but for some reason whenever I disable and then re-enable the UIDocument (in the second code block), the ...
skundu's user avatar
  • 1
0 votes
1 answer
51 views

How do I create a backward selection code?

Here is the code for my forward selection: ...
Lucy Adegbayibi's user avatar
0 votes
0 answers
44 views

How to draw new tile on existing tilemap

I created a simple prototype/script which has to draw a predefined tile on an existing tilemap (and highlight the hovered tile). But for some reason, even though it adds the tile to the correct place, ...
Suule's user avatar
  • 101
0 votes
0 answers
70 views

Does adding a new dictionary key-value remove other elements?

I'm using Unity Engine with C#. Currently, I have a weird issue. Here's the code for my dictionary: ...
modernator's user avatar
  • 1,213
0 votes
0 answers
92 views

How to make a hole of N vertices in the face of a Cube

I want to make a hole of N vertices in the face of a Cube, I'm adding just four like a square in this post to be simple, but eventually I want to be able to add as many as I want and maybe in a ...
ガブリエル Gabriel's user avatar
0 votes
0 answers
75 views

How to keep music playing continuously when switching scenes? [duplicate]

I added music to my game, but it restarts when transitioning between scenes. I want it to play continuously without interruption. What should I do?
ali aydınlıoğlu's user avatar
0 votes
2 answers
117 views

How to remove loading delay when loading from Appdata? Or to load everything at start?

Currently, when loading from Appdata, there is a noticeable delay. See a sample video here, when it changes from the sprite set in UI to the sprite loaded from Appdata through C# script. I want to ...
Junjie J2's user avatar
0 votes
0 answers
50 views

Enable socket interactor only when previous sockets are occupied

There are 3 boxes and 3 socket interactors. I only want the second socket interactor to work when there is a box in socket one and the third to work when there is a box in the first and the second ...
SPP's user avatar
  • 1
0 votes
0 answers
160 views

"SpriteRenderer does not contain a definition for SetBoneTransforms" error after downgrading Unity version

I built a project with Unity version 2023.3.0a and I had many problems with this version so I opened my project with version 2022.3.10f1, but I have some errors. I tried to reimport my project ...
Ali Ahmed's user avatar
-1 votes
1 answer
192 views

unity onTriggerEnter does not work

so in here there is a box to which i have attaches this script and ATTACH1 is a socket interactor here i want is when the box which i have attaches attaches to that socket interactor the text which is ...
SPP's user avatar
  • 1
0 votes
0 answers
94 views

How to stop object with joints flying away at high velocity on collision?

I am currently making a game where the player constructs vehicles out of blocks. I am achieving this through having rigidbodies for each 'group of blocks' separated by 'function blocks' (e.g. motors, ...
Renexx's user avatar
  • 1
2 votes
0 answers
160 views

Wrapping a mesh around another

I want to add LED strips to objects at runtime. The led strip is a very simple rectangular mesh that is generated at runtime. A shader then just draws LEDs down the length of the strip. Here is an ...
Charl Cillie's user avatar
0 votes
1 answer
40 views

Why is the grid's Z coords = -10

I'm using mouse input to move the player from where they are to where the mouse position is relative to the cell on a tilemap. However I found when I click on a point of the tilemap, the z coordinate ...
Maeson Williams's user avatar
0 votes
0 answers
39 views

How can I write the same code, but for Cinemachine?

I have a code for recoil, and this recoil rotates the camera upwards, and then returns smoothly back to the starting point.So, when there is a Cinemachine Virtual Camera component on the camera, the ...
Ivan's user avatar
  • 1
0 votes
0 answers
172 views

"Unable to create keystore" message from Unity for Android

I want to build a project with a release aab version. Unity asks me to create a keystore, and when I create one, it show this message: Android/2023.1.911/Editor/2023.3.0a6/Editor/Data/PlaybackEngines/...
Ali Ahmed's user avatar
0 votes
1 answer
63 views

"Button is not an attribute class" error when integrating Steam achievements

I am writing the code for my button, but it's giving me errors like this: Assets\Scripts\SteamIntegration.cs (60, 6): 'Button' is not an attribute class Where did I make a mistake in this code? <...
Syeda Aqsa Sakina's user avatar
0 votes
1 answer
102 views

How to save and instantiate game data containing lists of polymorphic types

Let's say I have a class named Entity such as: ...
Trobibot's user avatar
0 votes
0 answers
89 views

How to adjust resolution to display only in portrait mode for both phones and tablet devices?

I am facing an issue where I'm able to adjust the resolution for different phones like Android and iOS but not for tablet devices. Is there any way to set it, for all kinds of devices, to display only ...
Mohammed Rilwan Ibrahim's user avatar
0 votes
0 answers
41 views

Enemy not responding to chained attack

I am working on a 2D mobile platformer where there will be different characters with unique skill sets. I am working on a character that should be able to perform chained attacks. I have a button in ...
shanksVR's user avatar
1 vote
0 answers
47 views

Move UI element by a specific amount relative to current screen resolution

I want to achieve the following: At some point in the game, the UI Image (dashed rectangle) should shift towards the right edge of the screen (black outline rectangle) up until the part of the image, ...
maoam's user avatar
  • 111
0 votes
1 answer
52 views

Why are the transform game objects moving away from the snail when they are swapping their direction?

I am making a game in which I created a character (main player) and another character(snail). Now the snail will move on the ground, when there is no ground detected it will change its direction. I ...
gamePlay's user avatar
0 votes
0 answers
38 views

Missing tiles when rendering an isometric Staggered tilemap in Unity

I'm trying to show tiles on an isometric staggered tilemap in Unity, but some tiles are missing. I think the problem might be with where I'm placing the tiles or some floating-point precision issues. ...
Nick785's user avatar
0 votes
0 answers
21 views

How to stretch a cylinder when dragging with a Ray Interactor?

I'm making a VR game in Unity. I want to select a cylinder with ray interactor and drag it, and as I drag, it should stretch. This is the code I have currently for 2D: ...
SPP's user avatar
  • 1
0 votes
0 answers
23 views

why the car doesn't rotate with circle gameobject that the car is on to that

I have an issue with rotating objects with a circle that I create like this: I'm going on that but the car doesn't rotate with the circle rotator. Here is the rotator script that might help because I ...
Mobin Bagheri's user avatar
2 votes
1 answer
379 views

Character controller that can handle sloped terrain and boxy ledge traversal

I am working on a character controller for a 3D platformer in Unity. I cannot find an approach that satisfies me. I have experimented with these approaches in order to learn about their virtues and ...
DyingIsFun's user avatar
  • 1,307
0 votes
1 answer
135 views

What is the general technique of optimizing a game's lag by updating thousands of mesh vertices using DOTS parallelism?

*Edit: I finally figured out after some profiling that the problematic code was not actually the ones part of ECS, but this line over here: ...
rasputin's user avatar
0 votes
0 answers
30 views

Follow camera is not turning when the followed object turns

I need a camera follow script to chase a moving ball. I've attached the script below to my camera, but when the ball turns left and right the camera does not turn ...
Haseeb Ashraf's user avatar
3 votes
0 answers
59 views

How can I create good looking sprite color stretching metaballs?

It has been 8 months I've been working on my metaball algorithm an the final technique I am trying out is writing magnets to which the sprite mesh edge vertices will update its position to, after ...
rasputin's user avatar
3 votes
1 answer
1k views

How do I instantiate a scene and change properties on it in C#?

Using Godot 4, following a tutorial but the tutorial is in GDScript. It is hard to find one for C# so I am trying to convert it as I go. I made a scene called Coin and I have a scene called Main which ...
NibblyPig's user avatar
  • 221
0 votes
1 answer
64 views

Unity's Camera.ScreenToWorldPoint is apparently "missing", what could be the cause?

I have a small Unity plugin project set up (working on fixing a broken mod), and the Camera class seems to be missing a method. I've added Unity dll assembly references, and everything is working ...
Manius's user avatar
  • 101
0 votes
1 answer
1k views

How do I configure Godot 4.1.1 to use Rider as the IDE for C#?

I can't find out how to do this. I've installed the godot plugin into Rider. I found two tutorials, one says to open Godot, and go into Project Settings and find Mono and change some settings. However ...
NibblyPig's user avatar
  • 221
0 votes
1 answer
117 views

How do I properly use Entities and ECS in a current project that uses MonoBehavior?

I have a class called SpriteMeshModifier, which is a MonoBehavior. Since the rest of my script depends on this class being a MonoBehavior, I have trouble deciding how to translate the bulky updating ...
rasputin's user avatar
0 votes
2 answers
89 views

How do I optimize computations for multiple game objects(>1000)?

It has been 8 months I've been working on my metaball algorithm an the final technique I am trying out is writing magnets to which the sprite mesh edge vertices will update its position to, after ...
rasputin's user avatar
3 votes
1 answer
130 views

How can I check if `call`, `callv` failed

In Godot, how can I check whether e.g. Call(...) or Callv(...) succeeded or failed? By failed I mean due to e.g. missing method, ...
geekley's user avatar
  • 133
0 votes
0 answers
428 views

Resolve dependency between two installers in Zenject

Im trying to implemet dependency injection in my Unity project by using Zenject. I have two installers. The first one is Monoinstaller who is responsible for injection and creation of scene objects, ...
Ilya's user avatar
  • 11
0 votes
1 answer
683 views

How to use Camera.cullingMask to selectively render certain objects?

The documentation of this method doesn't provide any examples of implementing it. I don't understand how it works or even how I should use it to only render particular objects while not rendering ...
Nikhil Nair's user avatar
1 vote
1 answer
41 views

Instantiate prefab behind moving player

I'm trying to instantiate a bomb prefab behind the player. The script below works fine when the y rotation is 0,90,180,360. The bomb is instantiated behind the player. But for other angles, the bomb ...
single arrow games's user avatar
1 vote
1 answer
24 views

Isolating a mesh so it doesn't interact with Raycasts in Unity

My problem is as follows: I have a a convex hull of some points. Given a point that's outside of said convex hull, I would like to find the closest point on the convex hull. To that end, I have a ...
user1999728's user avatar
0 votes
1 answer
39 views

Making contributions to a Unity project without having Unity editor installed

I'm interested in setting up a small Unity open source project so that non-Unity devs can contribute. I would limit their involvement to making a small change to only one script, say adding a new ...
waffles13's user avatar
0 votes
0 answers
446 views

How to combine 2 splines from different spline container in unity spline 2.3.0?

I'm working on with Unity Spline 2.3.0, I realize that the splines cannot be touch and combine with other splines that exits in different spline container. Is there any way to connect them? I tried to ...
Duy Hạnh Trần's user avatar
0 votes
0 answers
37 views

Stitch meshes with different level of detail

I have an implementation for generating a mesh using marching cubes with different levels of detail. The issue arises when transitioning between meshes with higher vertex density (smaller scale meshes)...
z3nth10n's user avatar
  • 141
0 votes
1 answer
183 views

The bottom of the player capsule collider is going into the ground box collider

The bottom part of the player capsule collider is going inside the ground collider. I am using a raycast for detecting whether the plauer is grounded; an object (sphere) that is present on the bottom ...
Sami Rehman's user avatar
2 votes
1 answer
222 views

Why does Unity have no official gameplay framework?

As a generalist developer, I have made many server and backend apps and also client-side UI apps. Most of these environments have a certain architecture. For example, in most backend apps, even in ...
virtouso's user avatar
  • 2,628