C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

0
votes
0answers
2 views

Sever Structure for a Turn Based Game (Chess)

I am working on a Turn-based Game (Chess) I have done the client part and single player mode so AI is no problem here. But the only problem is now I want to make my project multiplayer. I have done ...
0
votes
1answer
21 views

Can't consistently add to TimeSpan for Unity Game

I'm making a game that has a timer showing how long the player has survived from being crushed by pessimism. (Long story) I'm trying to use TimeSpan in Unity to accomplish this but it seems that I'm ...
0
votes
2answers
27 views

Switching a project written in Lua to a compiled language

I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, ...
0
votes
1answer
21 views

Object reference not set to instance of an object Unity3D c#

public class player { public projectile pro; pro = GetComponent<projectile>(); void Update() { GameObject go = GameObject.Find("enemy"); Transform ...
0
votes
0answers
30 views

How to create normal map from bump map in runtime?

I am using this port of libnoise to generate noise. There are several methods (Noise2D.cs, 462 and 494 line) to output images. Second one, that should give me normal map does not work completely, it ...
0
votes
1answer
28 views

Getting Target position at the time of shooting

I have a bullet that has to hit a constantly moving enemy. So, in BulletScript, I have declared a Transform public Transform enemy; //and assigned enemy object to it that is ...
1
vote
2answers
24 views

C# - Collision Detection problem with platforms on Monogame(XNA)

So I am having issues with my platformer that I am developing. I can detect collisions fine when there are a line of parralel blocks or even single blocks. The issue I have is when blocks form an L ...
0
votes
1answer
26 views

XNA - Autodeploy .exe of game upon succesfull commit to GIT

I know of ClickOnce which creates an .exe file so a user can play my XNA game. However, I have to manually go through a wizard in order to create this file. I would like for the new .exe to be ...
1
vote
2answers
68 views

Loading and storing content efficiently

So for example I have a class called TypingKeyboard. It allows you to display a string while it's being typed by the computer with sounds. I need one in the menu, for the title. And one for the ...
-1
votes
1answer
57 views

How are grids made?

I've been looking at tutorials and researching forums and such but I still can't understand how the grids are made. I get confused at parts like this. for (int x = 0; x < Size.x; x++) { for ...
0
votes
1answer
48 views

What is the optimal way to handle matrix internal data storage for interop with native graphics apis?

I'm writing a managed (c#) game engine and have stumbled on a bit of a crossroads in design/implementation regarding matrix types. Matrix types need to be optimized for marshaling to native graphics ...
-1
votes
0answers
18 views

how to make unity3D client handle network message more effectly?

Recently I am working on a Unity3D client program. It will recevie message from game server. I use TCPClient to receive the message aync and store it to a locked queue. As u know, the client must read ...
0
votes
1answer
23 views

GUI Label shows on screen when object is out of view?

I have GUI Labels over NPCs in my game, and the labels display their name above their head. But when I walk away and go somewhere else, their names stay on screen like it's mirrored or something? ...
0
votes
1answer
101 views

Automatic Movement

I am making my very first GAME in Unity 2d. At the moment my game consists of 2 walls a floor, a ceiling, and a square which represents the character. After watching some tutorials I have created a C# ...
-1
votes
0answers
54 views

Projectile motion based off angle

I was using this code to hit an object that is moving horizontally(from right to left) and player on the left is throwing bullets to hit the object.But, what I am finding difficult is projectile ...
0
votes
0answers
18 views

Access public field of other module in unity [migrated]

I'm trying to read a field from another class library(mod) for Kerbal Space Program. I cannot directly access the field since the compiler is not aware of it and it is of a different namespace. ...
0
votes
1answer
104 views

Automatic Left/Right movement

First 2d game in Unity. Started Character controller in C#. Tried to get the character to move constantly right then once it hits the wall move left without needing any input from the player. Looked ...
1
vote
2answers
91 views

Simple square hit the wall and turn around without stopping

I am coding and making my very first plat former game in Unity 4.5 2D. Basically I want my character to ping pong between two walls. I have set up a GroundCheck and CeilingCheck. I was thinking to ...
0
votes
1answer
67 views

Binary Serialization of C# for GameObject in Unity?

I'm trying to serialize a GameObject (with children and textures) using the binary serialization for C#. It works with many data types but not with GameObject. In the docs it says should be ...
1
vote
1answer
43 views

Listen for asset modification in editor

I would like to listen for an event that some asset (prefab, precisely) has been modified. To my surprise, there's no such event in AssetModificationProcessor. Is there any way to do this in Unity?
1
vote
1answer
59 views

How can I determine whether a unit is in range or not?

I'm programming a small game that's going to be somewhat like a tower defence. I was playing around with how I determin whether a unit is in range or not. public void Update(GameTime theGameTime) ...
2
votes
1answer
42 views

change texture at runtime

How can I change the texture at runtime. I have done changing the label(text) at runtime. The following code is used using UnityEngine; using System.Collections; public class switchtime : ...
0
votes
2answers
67 views

Drag an object in unity3d

I want to drag an object to a perticular place.In case I release that dragged object before I reach that particular area ,the object should come to its initial place where i start to drag. How it ...
0
votes
4answers
128 views

Timing of coroutines in Unity is never precise

I was looking an official example for coroutines in Unity here. However, when I call WaitAndPrint the time taken is never exactly 5 seconds. IEnumerator WaitAndPrint() { float timeStart = ...
1
vote
1answer
139 views

Fast, simple procedural 2d island generation

I need to generate tile data for an island based rpg, my goal is have something that looks like this (mountains not required): For the past few days I have been trying to figure out a satisfactory ...
0
votes
1answer
42 views

Detect which key was pressed last each frame

Why hello there, im developing a 2D game using XNA. My character movment is currently based on the keyboard state. Example (in the right order): if (state.IsKeyDown(Keys.W)) { //Do ...
0
votes
1answer
37 views

Changing the object material without clicking on it

How can I change the object material automatically without clicking on it? The object material should change based on a timer.
0
votes
1answer
48 views

Changing the material on an object on click in unity

Iam working on unity2d.I have six game object Object1,Object1,Object1,(these are images) ObjectImage1,ObjectImage2,ObjectImage3(these are images). I have arranged the object in the scene as a list ...
0
votes
1answer
40 views

Continous collision happening in Unity2d

I am working on Unity2d. I have a game object called gameobject1 on screen. It holds an image (named "state"). When I drag a tree on a gameobject1 collision is happening continuosly in the same layer ...
1
vote
0answers
28 views

How do I setup scoring system for my game? [closed]

I've created a simple endless game. And I want the scoring system to be something like the one in flappy bird. My aim is to publish my game to app stores in the end. How do I save/keep a high score? ...
0
votes
0answers
34 views

Change the object when the object is clicked [duplicate]

In the above image, there are different icons for New, Open, Save, Save As and alternative images for when you click the icon. I have placed these images onto game objects. In the above menu when I ...
-1
votes
0answers
36 views

Changing the object when mouse is clicked on it

I have three object, in each object I have placed an image of a text. And I have another three images as same as that text but its is highlighted with the blue color. The first image is highlighted ...
0
votes
1answer
36 views

Generating a particle effect on top of a GUIElement (Unity)

I am working in Unity on a 2D project which is using C#. I have a number of guitextures which are hearts in order to create a sort of life meter. I would like when the player loses a heart for the ...
0
votes
1answer
30 views

Bounds Queries for Simplex Noise Function

How do I construct a Bounds Query for 3D Simplex Noise? [This is more or less a follow-up to my last question] Simply put, for an arbitrary octree node (cube) in my volume (a section of Unity3d ...
7
votes
5answers
2k views

Is C# different in Unity?

Does Unity use a different version of C#, or is it all the same? It looks different from regular C# but there are some regular C# elements in there.
0
votes
2answers
140 views

How do I create a knockback-movement?

I am a web developer new to game development, and with limited math knowledge. I am writing a character movement controller in Unity. The game has an isometric Diablo-like camera. The character moves ...
15
votes
3answers
2k views

Best way to store game-wide variables

I have an options Screen for things like Difficulty, Resolution, Full Screen, etc but I'm struggling to find the best way to store/obtain these variables at game time. The way I've currently decided ...
0
votes
1answer
46 views

Blender animation to XNA distortion bug

I followed the instructions on the following video: http://www.youtube.com/watch?v=SissgQ0IXvk I'm using XNA 4.0 and Blender 2.69 I export the model with animation to a .FBX file. The animation is ...
1
vote
1answer
48 views

MonoGame hosted in a control/form

I would very much like to host my monogame window inside a Form so that I can take advantage of the nice gui elements in the C# framework when creating a simple level editor. I have looked online, but ...
0
votes
0answers
16 views

Triangle does not show up using SlimDX

Here is the code: var elements = new VertexElement[] { new VertexElement(0,0,DeclarationType.Float3,DeclarationMethod.Default, ...
0
votes
2answers
79 views

Make a square flickering at a preset frequency

I'm working on a medi-sci project where I want the patient to use brainwaves to exercise control the environment. The environmnet is a 2D game where the game character is to be controlled by 2 ...
0
votes
1answer
35 views

Is there a build-in function to count the amount of sprites drawn by SpriteBatch per frame?

I'm hoping to find out how many sprites are on the screen at any given time. In other words, is it possible to find out how many times spriteBatch.Draw(); is called between spriteBatch.Begin(); and ...
0
votes
1answer
80 views

How should I detect collisions with objects on a “timeline”?

I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm. How should I check when each wall should be broken? Does the player animation use ...
3
votes
5answers
166 views

Can I extract Flash SWF sprite frames to bitmaps?

I want to create the 2D graphics of my game in Flash Studio, but then get all the frames from my SWF movies into C# for further work in Unity3D. I find it easier to create nice smooth animations in ...
0
votes
1answer
101 views

Angled topdown perspective camera for 2.5d game

I have a 2d tile based game created using Unity's 2d tools and orthographic camera: The tiles are created by programmatically generating a mesh, assigning a texture to each pair of triangles, and ...
2
votes
1answer
36 views

Unity refuses to open 2 popup windows

So am am making a unity program, where if you click 2 different objects, 2 different windows are supposed to pop up. To make them, I use private private bool showPopUp = false; private Rect ...
1
vote
0answers
38 views

XNA Library DrawPrimitives throwing primitiveCount error

I downloaded the project from here http://silverlight.bayprince.com/tutorials.php?tutorial=13 and tried adding a new OBJ file with a few thousand vertices listed. The classic teapot works but when I ...
1
vote
0answers
31 views

Monogame render between constraints

I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example ...
0
votes
0answers
45 views

how to add a spotlight effect to my targetenemy code

The current targeting code below changes the color of the enemy with tab button: Target enemy = change color of enemy to 'green' Deselect enemy = change color of enemy to 'blue' (press tab again) ...
1
vote
0answers
51 views

Any easier way to add networking to an XNA game? [closed]

I know that the MSDN has an article on this but I'm not developing for Xbox so I'm not sure if I should use NetworkSession or LocalGamer etc etc because I think they are Xbox only. But I haven't tried ...