Questions tagged [c#]

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

1,234 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11 votes
3 answers
4k views

Preventing a Combination of Rigidbody Jump Force & Bounce Magnitude in Unity3D

I'm building a fairly simple marble racing game in Unity3D. The ball is a 3D physics object that moves only on the X and Y axes. It has the ability to roll left and right, and to jump. Pretty basic ...
user avatar
  • 111
9 votes
1 answer
2k views

How can I Implement spin in billiard game?

I'm not sure that you played billiard or snooker before.if you played you should know about spin. but anyway if you don't know about it you can see it in this video I want to Implement spin like this ...
user avatar
8 votes
0 answers
1k views

How do I make volumetric grass?

I've been extremely interested in volumetric technology, especially for grass. Online resources are extremely scarce on this topic. What is the difference from creating a lot of mesh billboards? ...
user avatar
  • 193
8 votes
2 answers
2k views

NegaScout with Zobrist Transposition Tables in Chess

I'm trying to put Transposition tables into my alpha beta scout. I do see an incremental speed boost I think toward mid or late game, however, even with a table size of 1-2GB, its may or may not be ...
user avatar
6 votes
1 answer
2k views

Unity 5.3.5 - How to setup a lobby with general game settings?

I am currently working on the lobby for my game. I have followed these tutorials (https://www.youtube.com/watch?v=jklWlm5v21k), which were very helpful, and was able to setup my lobby like this. The ...
user avatar
  • 123
6 votes
2 answers
520 views

Collision detection problem in XNA4/Monogame

I have been trying to get 3D collision detection working for a while and I think (hope) you people can help me. For my project I have created a 'sprite3d' kinda class which is called ...
user avatar
5 votes
0 answers
586 views

Procedurally generated paths with intersections

The Problem I've been attempting to create some procedurally generated paths for a while now, but I've reached a problem when it comes to generating the intersections of the paths. The paths are ...
user avatar
4 votes
0 answers
263 views

Unity3d: calling a web service in unity editor works, but not in standalone. Why?

I have this line of code: SDE3D _webService = new SDE3D(); int result = _webService.UserLogin(txtLoginUsername.text, hashString); My ...
user avatar
  • 847
4 votes
0 answers
520 views

Why am I getting errors like these when trying to build my app

I am currently trying to build and publish my app to the universal windows platform halfway through the process of doing so, during the validation process I got stopped with these errors. The 1st one ...
user avatar
4 votes
0 answers
149 views

Monogame resizing GraphicsDeviceControl in WindowsForms?

I'm currently working on a custom Map editor using Windows Forms. I have a class inheriting from GraphicsDeviceControl (called MapDisplay) that I'm using so that I may use spritebatch to draw the ...
user avatar
  • 41
4 votes
0 answers
1k views

Are there performance benefits to using WaitForSeconds vs checking elapsed time in FixedUpdate in Unity?

I was considering that perhaps just checking the time and then doing some work in the Update function might look cleaner than calculating how long to wait for and calling yield new WaitForSeconds() on ...
user avatar
4 votes
0 answers
601 views

Rendering hundreds of animated characters in Unity3D

I am currently doing some research in anticipation of the development of a game where there are going to be hundreds of secondary entities which will interact with the player and among themselves (...
user avatar
4 votes
1 answer
217 views

Set input relative to map rotation?

I'm trying to figure out how I can make the input which looks like this : ...
user avatar
  • 469
4 votes
0 answers
3k views

Procedural Islands Voronoi Pattern

I'm trying to keep this as simple as possible, as I've found out the last few days this is a very difficult topic. I'd like to generate multiple flat islands, formed by a voronoi diagram. I've ...
user avatar
4 votes
0 answers
64 views

Why does interactive cloth not appear in game view in unity5 Pro?

I used interactive cloth fir flags in unity5 Pro version and it appears in scene view but does not appear in game view while playing. What can I do for that please somebody help me out?
user avatar
4 votes
1 answer
2k views

How to code a non-newtonian spaceship control script?

I'm working on a simple 3D space combat game, and I've decided to go with simplified physics over proper newtonian motion, similar to the space sim Oolite, and more 'arcade' style games. I basically ...
user avatar
  • 157
4 votes
1 answer
3k views

CPU Usage and Available Ram in Unity 5

In Unity 5 I would like to be able to print out the CPU Usage and Available Ram left in MB. I followed the code posted on http://zamov.online.fr/EXHTML/CSharp/CSharp_927308.html and used it, however ...
user avatar
  • 563
4 votes
1 answer
3k views

How to implement a professional fighting game input buffer?

Ok guys, I understand how to make a basic input buffer. Here is my code: ...
user avatar
4 votes
1 answer
1k views

XNA Webcam video

How can I embed a video in a XNA application? I'm developing a card game with XNA C# and I need to send webcam video between four machines. Could anyone give me some tips about that?
user avatar
  • 303
3 votes
0 answers
223 views

How to validate an Exception occurred as expected in a Unity Test?

I am trying to write unit tests in Unity that assert that logs, errors, and exceptions are raised as expected in my code, but I'm getting inconsistent results. I'm using ...
user avatar
  • 131
3 votes
0 answers
224 views

Generate a 2D field-of-view cone

I have a bunch of randomly generated boids flying around on my screen, but I want a function that can give them a field-of-view where they can "see" other boids or obstacles. The code I ...
user avatar
3 votes
1 answer
44 views

Spritebatch drawing the other way

I am drawing a rectangle using a emptytexture (1x1) and I use the following: ...
user avatar
3 votes
0 answers
62 views

Why isn't my method an option for onClick?

Update: The problem went away when I restarted Unity and tried again. The problem I am using Unity 2019.1.8f1 Personal with Visual Studio for Mac 7.8.4. I have a button named ...
user avatar
3 votes
0 answers
244 views

Limit mouse movement within 2 points

I have a circle sprite that i only want to move between 2 empty game objects (points). Using Vector3.Lerp() I'm able to move the circle between those points ...
user avatar
3 votes
0 answers
128 views

How to create a tube 2D in unity

I want to create a 2D tube in unity which I can cut, suture and drag it, My idea is to use a small image in form of fragments but how i can do it like the picture bellow EDIT : What I did until ...
user avatar
3 votes
0 answers
397 views

What is causing a SIGSEGV in mono_class_vtable_full in Unity for Android?

I'm a developer of a mobile game, and we have Crashlytics in our game. For the latest release for Android, we are having crash reports with the following stack trace, for a number of players: ...
user avatar
3 votes
1 answer
415 views

Create context menu in Scene view

I created some MenuItemfunctions for navigating, which are currently displayed on the menu toolbar. The C# code: ...
user avatar
  • 209
3 votes
0 answers
279 views

Quest UI Display in Unity 2D

I have this quest manager script where I store all my quests for easy duplication. I'm adding a feature that gives the player the option to see his/her current to-do quest. The first thing I ...
user avatar
3 votes
0 answers
49 views

Sprites being skipped over in simple sprite change script

Each instance of the prefab in question has a copy of this script on it, but they seem to be interfering with each other in some way. I would forego prefabs, except the final game I'm prototyping for ...
user avatar
3 votes
0 answers
339 views

Viewport not matching Window size when fullscreen

I am using: GraphicsDevice.Viewport.Bounds to determine the size of the canvas / stage for my window. This works well if I am in Windowed mode, but if I launched ...
user avatar
3 votes
0 answers
441 views

Pre-Hash Input Strings in Unity

So with the new Animator system, Unity has smartly allowed us to pre-hash the strings for looking up variables within the Animator state machine, using the Animator.StringToHash static method. This ...
user avatar
  • 131
3 votes
0 answers
127 views

How can I move the Player around the space station using the doors as waypoints?

The doors open automatic when the player is getting close to them and then close when the player get some far distance from them. Each door is built from door_right and door_left and I made that each ...
user avatar
3 votes
0 answers
62 views

Why the variable height value is all the time 0?

...
user avatar
3 votes
0 answers
416 views

Fog of War in Unity

I know that my question will not fall into the type of questions normally asked here (no coding presented). I just need some tips and advise on how to proceed (e.g. pipeline or something). I'm making ...
user avatar
  • 143
3 votes
2 answers
785 views

Efficient 2D grid overlay on tiles without each cell being its own GameObject

So for my game I need the ability to add a grid overlay over my tilemap. Now I don't think that making the grid with each cell being its own GameObject with some SpriteRenderer would be hard to do but ...
user avatar
3 votes
0 answers
1k views

Unity2D: Proper way to implement ladder climbing with a raycast controller?

I originally posted this on Stack Overflow, but was told I might have more luck here: I've been slowing grinding out programming features for my character controller, and one of the last things to ...
user avatar
3 votes
0 answers
735 views

Find Max Line Count for Unity UI.Text

I'm trying to determine the max line count of a UI.Text with VerticalOverflow set to truncate...
user avatar
3 votes
0 answers
63 views

How would one get the pixel value of a texture under the cursor?

I have a requirement to detect which pixel of a texture is under the cursor in the 3D world. I assume that Ray casting is involved however, after that I'm not sure how one would accomplish this. Can ...
user avatar
  • 153
3 votes
0 answers
1k views

How can i instantiate empty gameobject to be position to existing already gameobject?

When i click on keyboards for example dfrg i want that if i click on space it will add empty gameobject right after the letter g like a space for example: drg hello So there is a space after the ...
user avatar
  • 31
3 votes
0 answers
615 views

Making generic type T method as a layer of abstraction for Unty3D's EditorGUI field draw methods

I am making a visual tool for Editor Window on Unity3D, and I am just recently using System.Reflection methods to get class's assembly data, to get information about properties, fields and methods (...
user avatar
3 votes
0 answers
161 views

Design pattern for world objects caching

I'm developing in Unity a voxel-generated terrain and I'm trying to find an extensible design pattern for voxels and more in general, world objects caching. E.g. storing in a 'ChunkCache' class only ...
user avatar
3 votes
0 answers
2k views

Simple 2D Fish Obstacle Avoidance

I am currently working on a simple obstacle avoidance system in unity. I have a player and a school of Ai fish that are traveling in a fixed direction (Down-Right). While swimming, I want the Ai fish ...
user avatar
3 votes
1 answer
561 views

Start Broadcast Unity Network Discovery

I am using the unity NetworkDiscovery component, and I am wondering how I can auto-start broadcasting when the server starts, instead of the client having to click ...
user avatar
  • 131
3 votes
0 answers
274 views

Android game crashes when attempting to start wifi hotspots

I have two methods that will try to start the WiFi hotspot on the android device so that others can connect and play the game.the problem is both method have problems and don't work. the first method: ...
user avatar
  • 397
3 votes
0 answers
98 views

Stop Mesh render on intersect

I am generating camera frustum mesh through code, it is working fine. Now I am searching a solution (shader based or else) to restrict the camera frustum mesh if it intersect with any object. Like you ...
user avatar
3 votes
0 answers
370 views

Flow effect to static water on a isometric city

Hello everyone I want to give the idea that the river in my city is flowing but I am having an hard time to figure how. Do you have any idea of what I should look into to?
user avatar
3 votes
0 answers
116 views

How to disable and enable a randomly generated prefab in an endless runner 3d

Hi all I have been experimenting the endless runner game for some time and needed to optimize it. I read some articles about optimizing my game and it says that once you instantiate the prefabs in the ...
user avatar
3 votes
0 answers
271 views

UNET Performance of (many) Kinematic Rigidbodies

I am building a game in Unity in C# using the UNET networking elements. I am trying to figure out what is the performance cost of kinematic rigidbodies? My understanding is that, when kinematic, ...
user avatar
3 votes
0 answers
489 views

Polygon 2D collision response- How do I find the correct edge a polygon hit?

Hey guys I've been seriously stressed out by this, so please go easy on me. My goal is to reflect a bullet (polygon) off of another polygon, and find the edge the another polygon, A (the bullet), hit....
user avatar
  • 773
3 votes
3 answers
322 views

Animation clip not working

I am working on playing different animation of key press.Below are the animation element attached to my player Initially run animation is played.I have written code to play "Jump" animation on ...
user avatar

1
2 3 4 5
25