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
22 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
28 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
20 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, ...
Russel Ledge's user avatar
0 votes
1 answer
47 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
20 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
11 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
22 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
119 views
+250

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
105 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
22 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
41 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
2 votes
1 answer
55 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
  • 151
0 votes
1 answer
31 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
90 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
  • 151
0 votes
1 answer
33 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
75 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
49 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
15 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
17 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
38 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
21 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
34 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
32 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
21 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
64 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
118 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,566
-1 votes
0 answers
101 views

How to generate levels similar to Spirit Hunters: Infinite Horde?

I am doing research on map generation, and want to know how to generate something like this area in the game Spirit Hunters: Infinite Horde: Here are the specific features I want to reproduce: Layer ...
Ahmad's user avatar
  • 1
0 votes
0 answers
32 views

How to change the locomotive status from moving in a spline to moving in the next spline when it meets the next rail?

I want to make a train that can move in a curve. I have downloaded a Train Spline Walker unity package. That package can generate a spline, and the train's locomotive will move in the spline with a ...
Duy Hạnh Trần's user avatar
0 votes
1 answer
42 views

How to Constantly Apply a Force to a Rigidbody Within a Coroutine?

For my game, I am trying to write an enemy behavior script, where the enemy walks forward for 1 second, then stands still for 1 second, then walks forward, stands still, etc. To implement this, I have ...
NateBob's user avatar
0 votes
1 answer
43 views

How to make a moving GameObject push a CharacterController smoothly?

I have a GameObject called Player with a CharacterController component attached that has the following settings. Player also has a script called PlayerController ...
Magnality's user avatar
0 votes
2 answers
75 views

Player double jumps immediately with a single press when using new Input System

I am making a 2.5D runner game and I want to switch my input from the legacy Input Manager to Unity's new Input System package. I am facing a problem when I'm trying to implement the double jump when ...
Sami Rehman's user avatar
2 votes
1 answer
136 views

Why can't I access my custom signal under the SignalName subclass when trying to emit it?

I have recently decided to start learning Godot after previously having experience with Unity, and am continuing with C# as my primary scripting language. While everything else regarding signals seems ...
Deano's user avatar
  • 23
1 vote
1 answer
49 views

Efficient Queries in an archetype-based Entity Component System

I am currently writing an archetype-based ECS for learning purposes. What I noticed is that my current implementation is incredibly slow with large amounts of archetypes. Each of my queries iterates ...
genaray's user avatar
  • 517
2 votes
0 answers
55 views

How to get wave height of a gerstner wave made in shader graph?

I have followed a gerstner wave shader graph tutorial. (YouTube Tutorial) I am now trying to implement buoyancy by attaching the following script to a gameobject. (YouTube Tutorial) ...
Magnality's user avatar
1 vote
0 answers
19 views

Move a non-convex polygon's outline inwards?

The polygons are small 3D parts of a quasi sphere centered in the origin and a solution that works in the plane can easily be made to work in this world. I tried to move the outline inwards by using ...
August2323's user avatar
0 votes
0 answers
39 views

StarterAssetsInputs OnLook is not triggering in Unity New Input System

I have StarterAssetsInputs script which based in new input system but it's onLook event is not triggering at all. Reamining functions like onSprint, onJump are working fine. But unable to find why ...
Muhammad Faizan Khan's user avatar
3 votes
1 answer
65 views

How would I generate mipmaps for a 3D texture in Unity (at runtime)?

I have been trying to create a voxel cone tracer for Unity (in Universal Render Pipeline 16). I have this (unoptimized) C# code that turns the [CubeScale] area around 0,0,0 of the scene into a 3D ...
MacksNotCool's user avatar
-1 votes
1 answer
82 views

The Random.Range function isn't activating when I call it. How do I get the function to work properly and call from a range of numbers?

As you can see, I'm attempting to set the random prey integer to a number within a random range like so: randomPrey= Random.Range(0,10); As I type the code out the .Range doesn't turn yellow and the ...
Gideon Falls's user avatar
1 vote
1 answer
100 views

How do I make an interactive visual indicator in Unity?

I have a pad I interact with in my game. How do I make a visual indicator like the one shown in the attached GIF? You see that there is a circle that appears on the tablet showing where the user is ...
Craving_gold's user avatar
0 votes
1 answer
46 views

How to loop over labels start from 1 to 4 and not from 0? [closed]

...
user1741587's user avatar
0 votes
0 answers
29 views

My sprite rects are flipped vertically in Unity Sprite Editor after being processed by code

I'm currently trying to process an Adobe Animate XML file with a Unity editor script, and I'm a lot of the way there, my parsing is complete, and I'm able to get some form of output, however the ...
SnowDev's user avatar
1 vote
0 answers
56 views

How to get OnTriggerStay2D working?

I am trying to make a flamethrower weapon for my player character. I am using a system were I can change between weapons, and every other weapon works perfectly. The flamethrower is able to turn on ...
the gibby's user avatar
0 votes
0 answers
29 views

OnServerSceneChanged not executing

I've been trying to make a multiplayer game with mirror networking. The Network Manager works correctly when it comes to changing the scene, but the ...
koogel's user avatar
  • 79
0 votes
1 answer
57 views

My Update method is shown as unused, yet I'm coding within it

I'm doing a game lesson to get basic player movement working using Unity "Lesson 2.1: Player Positioning". I started with creating the public variables and getting the axis and the ...
Mila Data's user avatar
0 votes
0 answers
54 views

Scene transitions to Game on host, but not on player client

I've been following Mirror tutorials on Youtube, where there was a transition between a lobby scene and a game scene, I wanted to add a loading scene inbetween them. The issue is the game transitions ...
koogel's user avatar
  • 79
0 votes
1 answer
48 views

How to make enemy turn to face the player while attacking?

I need help making this code work. It is made for the enemy AI to move and patrol, chase the player and attack the player. The problem is when it starts to attack the player, then the player can move ...
Darius Van Vuuren's user avatar
1 vote
1 answer
155 views

Intellisense broken after installing Unity VSCode extension

I didn't use VSCode since two weeks ago. Today, I opened my Unity Project. VSCode updated some extensions and unhappily, Intellisense doesn't work anymore. I didn't change VSCode settings — all ...
Achie1's user avatar
  • 169
0 votes
2 answers
48 views

How to keep an object that rotates around another at the same height when the radius changes?

In my game, I have one object that rotates around another using transform.RotateAround, and I need to change the radius of its orbit. The behavior now is that the ...
Oled Neduda's user avatar
0 votes
0 answers
53 views

GameObject getting stuck on wall

I am making a simple character controller. Whenever I continuously walk into a wall, gravity just stops working. For example, if there is a wall in front of me, and I jump and walk into it while in ...
kalilamodow's user avatar
0 votes
0 answers
44 views

How to fix the flag bool variable become null and never stop the coroutine?

The script is attached to some objects and in another script when checking distance, I'm starting the blinking and then should stop the blinking. but it's never got inside the stop method because the ...
Shelly Ron's user avatar

1
2 3 4 5
165