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

I can't add the change I made while the game is running to the list?

Node script is shared below. The Node script works fine when I run the game for the first time. However, while the game is running, when there is a change in the map, the list specified in the script ...
0
votes
0answers
16 views

Can't publish app bundle because it can't be installed on Android 12?

I wanted to publish a newer version of my already published game to the PlayStore but it wasn't letting me therefore: "You uploaded an APK or Android App Bundle which has an activity, activity ...
0
votes
1answer
15 views

How to apply brightness/contrast adjustment to a texture's pixels?

I'm trying to use a non-shader method to convert a (single-frame) Texture2D to one with different brightness/contrast. Attempt so far uses: https://stackoverflow.com/posts/15408608/revisions I'm not ...
-1
votes
1answer
26 views

Why the transform is never moving and reaching the last fifth last waypoint?

I have 5 waypoints ,each waypoint tagged and named as "Teleporter". The Mover the blue cube is start moving to the first waypoint and then should move between all the other waypoints. but it'...
0
votes
0answers
12 views

Tuples in Unity, or how to store two pieces of data in as a single entity in a sortable list? [closed]

I'm currently trying to figure out a way to store a Vector 2 and an int together as an item in a list, in order to be able to sort a list of destinations by priority (indicated by the int stored with ...
0
votes
2answers
62 views

Converting from global coordinates to local coordinates

I am trying to create a Radar/Minimap for the F1 2021 game in C#/WPF. Here is a image of what I am trying to replicate In the image, the white car (my car) will always face the direction it is going. ...
0
votes
0answers
13 views

Cinemachine lock on

I'm using Cinemachine for a free look 3rd person camera and a virtual camera for a lock on cam. I already have switched Cinemachine brains and movement types done, but I need the player to face the ...
2
votes
1answer
33 views

OpenTK immediate mode on net core doesn't work?

I have some old code that i imported into an OpenTK C# application running on NET 5.0. The rendering uses old fashioned immediate mode and it works on my current computer but nothing renders in the ...
0
votes
1answer
38 views

How to add delay to the moving objects?

Now all the moving objects are moving like a group to the same target. I need them to move to the same target but with a delay between them. The first object start moving to the target after X seconds ...
0
votes
1answer
14 views

Clarification of functionality of Vector2.MoveTowards method

In Unity's documentation for Vector2.MoveTowards, they assign a two variables, "speed" and "step". "step" is simply speed * Time.deltaTime. Why is this step variable ...
0
votes
0answers
31 views

Unity code design - Events

I am aiming to create a Unity project with a code structure similar to ECS. I want the code to be consistent, easy to integrate extend and expand if multiple developers will work with it. By that I ...
0
votes
1answer
26 views

Slowing down mouse movement in Unity

I'm using the game to control electronics. I use the following code to determine the location of an object (the location is used to perform calculations that are sent to the electronics) ...
0
votes
1answer
34 views

What is the best way to present "rate this app/game" with unity/c#?

I want to give my users a chance to rate my game at the Google Play Store. How can I achieve this on Unity/C#? I would like users to be able to rate instantly inside the game window without being sent ...
0
votes
0answers
27 views

How can I fade in out object/s?

In general the main goal is to teleport between teleporters with fade out/in when teleporting. but for testing the Fade I call the Fade method once in the Start : ...
0
votes
1answer
20 views

How to change size of a SINGLE tile on a tilemap at runtime?

I'm having trouble figuring out how to change the scale (size) of a single sprite (tile) on a Unity Tilemap. In the game, I place trees as tiles on a tilemap, and when they grow over time, I want to ...
0
votes
1answer
30 views

How to use AddComponent to add an instance of the derived class, not the base class that defines the method?

This is my base class ...
0
votes
0answers
13 views

When using animator state with parameters conditions type trigger it's working only for the first but why it's not working for the second?

In the Animator Controller I added a new state with animation the idea is to make a smooth transition between the idle to the new state animation. The first transition is using in the conditions the ...
1
vote
0answers
53 views

Odd behaviour from parallax

First of all I'm going to say that I'm not trying to blow my own trumpet or anything but usually I'm able to figure this stuff out on my own. But as for now I'm fully stumped. Maybe I'm having a mind ...
0
votes
0answers
24 views

High rigidbody drag value gives weird speed readings

when calculating speed in unity ...
0
votes
0answers
28 views

How to change fall delay of a gameobject by time?

I want my gameobjects to fall faster by time as the player collides with them. What I mean is, when the game starts, the gameobjects fall off after 1 second the player collided with them, but after 60 ...
0
votes
1answer
32 views

How to make the object to move to the target smooth ease in out from the player hand and back?

The problem is that I'm using Lerp and if I'm making the transform to move from the originPosition to the target(destinationTransform) it's not moving from the player hand but from another position ...
1
vote
1answer
21 views

How to return an unknown amount of data from a parallel job? (C# Jobs + Burst)

Say we have a parallel job (implementing IJobParallelFor) which requires a large array (>100,000 items) as an input to do some complicated processing. After said ...
1
vote
1answer
49 views

C# Jobs + Burst executing slowly (bottleneck?)

I'm trying to make a system where the player can do a RTS-like drag-to-select of tiles in a box to mark trees to be chopped or ores to be mined. I'm testing this system on a large scale, possibly ...
1
vote
2answers
62 views
0
votes
0answers
9 views

My object didn't follow a target when it got spawn initially, only after it passed its target? [duplicate]

It didn't follow after it got initiated, but when it went by my target, it made a U-turn and then it starts to chase after the target. This is my object that is supposed to follow my target like a ...
0
votes
2answers
88 views

Unity Game - Multiple threads to improve AI bulk computation?

I'm making a chess-like game with an AI that implements minimax algorithm with alpha beta pruning. The AI raw computation is effectively infinite, so I'm forced to limit the depth I traverse, thereby ...
0
votes
0answers
16 views

My object didn't follow a target from my script that spawn the said object?

This is my object that supposed to follow my target like a homing missile: ...
1
vote
1answer
57 views

How to associate text with each sprite in a list?

I have made a simple script, where I am changing image sprites by button click. I want to give an explanation for these images, so I am wanting to add text components for each sprite. How to do that? ...
0
votes
0answers
45 views

Changing Input.GetMouseButtonDown to use new Input System Package

I want to develop a new football game. I placed a cube called "BallTrigger" in the player's foot area. In this way, I wrote code so that the player can shoot the ball. But when the player ...
0
votes
0answers
24 views

How to unlock a level using a textbox question (with one correct answer)?

I'm currently working on a 3D Unity game that has 3 levels, but each level has to be unlocked by answering a question to walk through the door leading to the next level. I have a next level trigger ...
0
votes
0answers
14 views

How do I get the drop down list in visual studio 2019 to show things such as gameobject when I type that out? [duplicate]

I typed out "public" which did showed up in the drop down list, but typing something like "gameobject" gave me things such as #if or #region.
0
votes
0answers
16 views

Is it possible to get another public variable from another script?

I am making it so that if you click a box, it teleports over an object and that objcet detects the collision. The characters dialog script is inside of a character I made. I also have a boolean value ...
0
votes
0answers
15 views

Creating custom timeline with script at runtime in unity?

I know this is possible but can't really figure out how to do it properly and to be hones there are so many things in docs related to this that I really don't know where to look. I basically want to ...
0
votes
0answers
17 views

2d box collider doesn't work on my 3d model UNITY

i am still new to unity but i am trying to apply a 2d box collider to a 3d model ... i am trying to make a fruit ninja clone with trail renderer and i am using circle collider 2d on the trail so i ...
0
votes
0answers
22 views

Booleans cannot be changed between scripts in Unity

In my game there is a game manager that interacts with all players and is able to change whether a player is actionable by accessing their script. However, the Game manager script simply refused to ...
0
votes
1answer
28 views

How can I get/set values within a custom array in unity?

I wanted to create a custom array that contains both strings and integers to represent the name and amount of an item a player has. While this did work in the inspector, I don't know how to access or ...
0
votes
1answer
53 views

CR LF replacement in Unity Input Fields when copy and pasting

I setup a bit of code to detect line breaks using \n char (line feed), from the TMPro_InputField: ...
0
votes
1answer
35 views

Serialize List of References

I have a list of object references inside a serializable class, like this: ...
0
votes
2answers
21 views

I keep getting errors as I don't know how to deactivate a script that doesn't have a game object, presumably my script that "spawns objects"?

I know how to deactivate a script that has the game object but I keep getting errors as I don't know how to deactivate a script that doesn't have a game object, presumably my script that "spawns ...
-1
votes
1answer
52 views

In Unity, why won't the speed change when I'm crouching?

...
1
vote
2answers
68 views

How do you break up or architect Unity scripts?

I have a player script that is turning into a bit of a monster. I don't know too much about Unity so I'm just jamming the whole game logic in there which does not seem right. The player is currently ...
0
votes
0answers
10 views

Unable to draw Primitives on Texture in SharpDX

I have a little problem with rendering in my SharpDX Direct11 App. I had being tested rendering scene on a texture, and then draw this texture on the backBuffer. ...
0
votes
1answer
36 views

Gameobject does not derive from MonoBehaviour

I am trying to put a gameobject into a prefab. Unity says "You are trying to save a Prefab that contains the script 'NPCDebugInfo', which does not derive from MonoBehaviour. This is not allowed. ...
0
votes
0answers
24 views

How can I make a child of an object move when the parent moves in Unity 2D?

Here is my code for spawning the jaw of one of my enemies. It is set to a child of the main enemy as I'm controlling the animations separately for different parts of the enemy: ...
0
votes
0answers
31 views

Can you somehow do WAN for Mirror in Unity without port forwarding?

Basically i'm using Mirror and it works perfectly when I and my brother wants to play the game I made, but we're on the same network. When my other brother who doesn't live at home can't connect ...
0
votes
2answers
42 views

Unity 2D Script affects all current objects in a Scene

I looked around for a fix because I am sure it's either super simple of a fix or something that is commonly run across but nonetheless it's about time I asked straight up. This is my code in the ...
0
votes
0answers
30 views

Playing Video Files in Windows Forms with MediaPlayer

With the following encoding, only the audio part of the video is played, but the video itself is not shown: ...
-1
votes
1answer
26 views

Setting joint angle from a slider makes joint spin continuously [closed]

I use sliders to change the rotation angle of my joint, like this: ...
0
votes
0answers
43 views

How to make a 3 hit combo in Unity

I had used a tutorial to set up the attack, but is was only for one attack. I tried to modify it for a combo, but it plays all the animations at once. How can I change this to work as a 3-hit combo? <...

1
2 3 4 5
155