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
15 views

Implementing beat detection algorithm on mobile

So, I've been looking for a way to detect beats on a streamed song on mobile(like listening on Spotify or Youtube etc.) I've found the most used methods are either using already known songs or using ...
0
votes
0answers
34 views

C# Convert List<T> to multidimensional float

I have a list of Vector3 structs like this List<Vector3> cloud I want to convert this list into a 3 dimensional float array ...
0
votes
0answers
32 views

Arrange a list of objects based on an integer c# unity [closed]

i have a list of objects list charList = new list(). i iterate through the list and run a function called rolledInitiative which generates a random int called Initiative. I want to arrange the list ...
0
votes
0answers
35 views

If I don't start on the 'main game' scene, but then load it via a main menu button, the ground will be black and white!

If I play the scene where the actual gameplay takes place, from the editor, the game begins like so: However if I play the main menu scene and then use a button, linked to an empty game object (which ...
0
votes
1answer
75 views

How to control which path a unit will take?

This might be a really easy solution that I probably just do not know due to lack of experience so thanks for any and all the help. TLDR at bottom of post. I'm still learning Unity / C# and I am ...
0
votes
0answers
24 views

How can I continue to rotate a 2D UI Object using OnPointerEnter when object is on its side? (OnPointerExit is triggered)

I have been wracking my brain on this for days. I'm trying to create a nice looking hand of cards, when the card is hovered over, it bobs up and down and rotates. This is triggered by OnPointerEnter, ...
0
votes
0answers
20 views

How can I return a Dragged Object From a Layer Group to its Original Position?

I'm trying to work on a card system, I have a drag system going nicely and the cards are setup on a horizontal layer group, however, when the player drops the card outside of the "casting area" I ...
1
vote
1answer
27 views

How can I rotate a cylinder so the top points at specific transform?

I have a GameObject (goA) with a LineRenderer that has a single line drawn, on which I'd like to place cylinders so the top of the cylinder points to each end of ...
0
votes
1answer
12 views

My script doesn't read my prefabs

My script is supposed to randomly spawn different slipper projectiles from an array, but when I hit Play Mode, my filled prefabs disappear from the script. ...
0
votes
1answer
36 views

How to transition between “rooms” / virtual cameras on a button press?

I'm trying to make a game that navigates like the example here: I'd like it so that after combat, the player can push the button corresponding with an exit (left, right, up, down) and navigate like ...
0
votes
1answer
39 views

Instantiation of a custom class

I have a custom class named Stars: ...
0
votes
0answers
31 views

Follow Camera to Two objects at different time

I am developing simple 2D game in unity. I am locked with the camera movement for last two days. I've camera script that is working as follows: Follow the player to X and Y direction If player stops ...
0
votes
0answers
24 views

Random quantity spawn on set location at a given time [closed]

I need to make an object (a box) spawn at a set location given by me, at a set time given by me. I also need to spawn random objects inside the box. If objects have been collected from the box, no ...
1
vote
1answer
39 views

Update variable before building the unity build

Before building the standalone build I want to update one of the variables in the script using this. ...
0
votes
0answers
60 views

Multithreading bug

I am following Sebastian Lague's video tutorials on how to create a procedurally generated world. I have followed his tutorial fully except for the fact that I created a double precision algorithm for ...
0
votes
1answer
15 views

How can I extend the FindObjectsByTag to filter multiple parents of the found objects?

...
1
vote
1answer
56 views

Why it's not removing the right doors from the list?

...
0
votes
0answers
21 views

Calculating the correct scale for game-object

I am currently trying to make my own custom grid-tile system for my game. I am making it such that all the tiles spawned in the grid will fill up exactly half of the display's width size, but I am ...
0
votes
0answers
27 views

Generating triangle indices for marching cubes mesh

So I am making a programily generating cave program and I have all the vertices but I have no idea how to solve for the faces of my mesh. My code: ...
0
votes
2answers
62 views

Random point on a square floor

I have a flat 10x10 surface (floor) made out of cubes of 1x1x1. I am spawning objects from the "sky" and I want them to fall on random points of the surface without exceeding the surface limits. Is ...
1
vote
1answer
34 views

Calculating 3D character movement based on YAW and Pitch

I'm not sure how to calculate an XYZ immediately to my characters left based on the direction they are facing. I am learning to create a 3D game in Monogame on top of .Net Core 3.1 in c# using ...
0
votes
0answers
60 views

How should I cycle my game to be more scalable?

I'm trying to improve my game emulator so it can handle more users. I currently have one separate thread and execute all processing there. The cycles processes players and rooms, rooms are individual ...
0
votes
0answers
18 views

Sprite Distortion (Ghosting While Moving and Artifacts when Mirroring to External Display)

I am working on my first MonoGame project. I love the framework so far! I have implemented my own letterbox/pillarboxing to scale my native resolution by the maximum integer scale allowable on my ...
0
votes
1answer
43 views

Wonky perlin noise

I am quite new to the wondrous world of "Procedural Textures", and I am trying to create a double precission perlin noise algorithm. I am almost done with it except for the fact that the coordinates ...
2
votes
0answers
43 views

how to get android activity callbacks in unity c#?

i know unity works on android activity named "UnityPlayerActivity" the activity has some callbacks like onCreate onResume onPause etc... assume we wrote an actvity class that derives from Activity ...
1
vote
0answers
35 views

Creating custom types that extend certain objects

Really new to C# scripting. I'm trying to extend a TileBase type object to be able to hold custom methods and variables. I want to create a pathfinding script and ...
0
votes
0answers
30 views

Assign 100 materials of different shaders with their respective 2D textures to one shader automatically?

Is there an editor script to assign all materials to one shader specifically including copying the texture? I have found an editor script that changes the shader but does not copy its texture. How can ...
1
vote
1answer
32 views

Raycast check for Collisions across XZ coords without Y rotations / Unity C#

I'm really new to Unity/C# (I have a bit of experience in GML but far from professional) and I am currently building out my first prototype. I originally copied THIS script to get a cube that rotates ...
1
vote
0answers
42 views

Aerodynamic Physics

The current unity physics engine is limiting in the sense of drag. It's just not good enough. After a lot of internet sailing... I found this post. https://stackoverflow.com/questions/49716989/unity-...
1
vote
1answer
51 views

Throttling or adding delays between OnTriggerEnter2D calls

I have 2 game objects: Explosion and Enemy. At any given point, an enemy can collide with multiple ...
1
vote
2answers
34 views

Make Render Texture distorted/blurry?

I have created a function that clicks images in real time and these images are copied to render texture that is created. I am looking for a way to blur/distort/half-fade-out the render textures. Is ...
0
votes
2answers
90 views

How do I pause the game immediately when it starts?

I want my Unity game to start with Time.timeScale = 0f becuase it starts with a main menu that is in the same scene as the game. I tried to put Time.timeScale = 0f in Awake() but that did not work as ...
0
votes
0answers
28 views

Generating a sprite using a list of points

I am trying to dynamically generate a sprite in Unity to visualize a list of points. What I've got so far is creating a small Texture2D object and then trying to override the geometry: ...
0
votes
0answers
43 views

Camera looking around with mouse - Unity, C#

I am building a script in C# for camera logic in Unity, the camera is supposed to follow the player (a 3rd person character) around and the user should be able to look around using the mouse, so far ...
1
vote
1answer
58 views

Sprites looks blurried on fullscreen

I'm trying to make a pixel art game and my resolution is 384 x 224, but when I change to fullscreen the sprites looks blurry and I don't know how I can disable bilinear filtering. I tried ...
0
votes
2answers
45 views

How to switch between multiple cameras in a Unity Scene, Silent Hill-style

I have 3 cameras in a practice scene that I want to switch between. Currently, I have a meshless cube acting as a trigger with the following script ...
5
votes
1answer
603 views

How to code shaders in C# without resorting to other programming languages?

I'm working on game and game engine and want a way to prototype shaders. I'm not skilled with C++ or GLSL or HLSL or STH, but I can code in C#. My question is: How can I code shaders in C#, without ...
0
votes
0answers
36 views

Render Texture shows opposite view of camera when rendered?

I am using render texture (cube) to render what camera sees into it. However, the render texture shows me opposite side of cameras view (flipped) instead of what camera sees. Any solution for this? <...
0
votes
0answers
15 views

Fill Unity Terrain Group from Script

I want to split a heightmap up to load it into a terrain group from a script, how could I do that?
0
votes
1answer
37 views

Long / lat from x, y coordinates and vice versa

I have downloaded a map file which I'm using as a texture on a plane. The file is a proper map file with projection in a prj-file and a tfw-file. The prj file contains: ...
0
votes
1answer
67 views

Unity performance issues when rendering items

I'm trying to get the position of items in the game world and render them onto the screen. I've managed to get this working, however I seem to be running into major performance issues when ever I ...
0
votes
2answers
32 views

Adding a time-delay without changing the function signature

I have written a simple generic implementation of the BFS algorithm, which I intend to use in several places in my Unity game. A simplified version of the class is: ...
11
votes
2answers
5k views

Is it a good option to simultaneously work on a game and a game engine? [closed]

I'm considering this, now I work on 3d game but I want also to make in slow tempo, iteratively a game engine is it a good choice? The game what I working on is with non custom engine (Unity, Unreal ...
-1
votes
0answers
37 views

How to connect augmented models in unity?

I am developing an app which will help students understand how the actual flow of current takes place in an electric circuit. This video is exactly what i am desiring to build. :[https://www.youtube....
0
votes
1answer
30 views

“Instantiate” function in Unity spawns enemy but it doesn't show up

So, I'm making a top down shooter (2D) and I already made an enemy prefab. It walks to the player and damages it, and reacts to bullets physically until it eventually dies. The prefab itself is ok, ...
1
vote
1answer
38 views

Unity C# Scale 2d Object with Mouse Drag

So I have had a few attempts and posts about this but have still not been successful. The behaviour I want is this: There is a circle (sphere) I want the player to be able to click and drag it ...
1
vote
0answers
27 views

Create animation clips programatically

I am messing around with Unity and the LPC Spritesheet Collection. The LPC sprites are a set of artworks all of the same size and the same amount of animations. I can create animations for it no ...
0
votes
0answers
66 views

Randomly generated maze in Unity not generating nor throwing errors

First and foremost I am very new to Unity, my issue may be attributed to my incompetence however it is still an issue nonetheless. My goal was to create a randomly generated non-euclidean maze. Since ...
0
votes
1answer
26 views

How to store a Transform[,] grid in an ArrayList?

I am new to Unity game dev and trying to expand my knowledge of data structs. I'm building a match-3 game, and I currently have a multi-dimensional ArrayList holding transform coordinates on a grid of ...

1 2 3 4 5 131