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
1answer
3 views

Simple way to shoot bullets from a ship at angles for shoot em up

Just like the title says. I'm working on a shoot em up for a personal project, and I can't seem to get this to work. I don't have any code for it, but I do have the code to make my ship shoot, but ...
1
vote
1answer
13 views

How can I draw some of my XNA models semi-transparent? (C#, XNA 4.0)

I've recently made some basic Blender models without transparency for a new game I've been working on, but I'm having some problems rendering them semi-transparently. Namely, I haven't been able to ...
0
votes
1answer
16 views

Graphics, drawing triangles

I'm very new to the world of Computer Graphics, and I'm struggling to find resources to help me understand how to draw my mesh (I have loaded everything into vertex and index buffers), I am not using ...
0
votes
1answer
39 views

How to force a translation to go through an exact point?

I have a camera object with a script that will whether translate it with a set speed, or stop it. I also have 7 "checkpoints", where there are 7 different quads, who will stop the camera whenever the ...
1
vote
1answer
41 views

Why doesn't OnCollisionStay execute continuously?

I'm currently trying to build a simple demo where the player can jump. This is the script I have setup so far. using UnityEngine; using System.Collections; public class PlayerJump : MonoBehaviour { ...
0
votes
0answers
18 views

How can I get any value from a HashSet? [on hold]

I have a HashSet that represents a bag of numbers that can be assigned for a unit's ID and any number in the HashSet is valid. I'm having trouble retrieving a single value from the HashSet though. Is ...
1
vote
0answers
6 views

Using Lidgren and RSA in Unity game with Windows Store build

I am using Lidgren and RSA in my networking framework, but things like IPAddress are "nonexistent" when I try building for windows store. RSA classes don't work, either. How could I use this in ...
0
votes
1answer
42 views

Any way to visualize how will game objects look on different screens?

After completing my game and sending it to a bunch of friends with different devices, they complained about how some game buttons were too small. (I have developped a touchscreen game but after ...
3
votes
2answers
166 views

Implementing A* with Heap tree

I'm trying to implement Heap into my A* algorithm, However I'm having trouble with implementing one method. The Contains method. Which checks if the heap array has a specific node in it or not. I ...
0
votes
1answer
33 views

Unity 2D: Change one instanced prefab then make all the others on the scene like it

I want to get this thing working: I have a prefab with coins, some obstacles and enemies, and i want it to be instantiated each time the player got to the right or left on the stage, to make the stage ...
0
votes
2answers
36 views

Detecting on which side did the objects collided unity 2d

I have a ball and a rectangle in my game. The rectangle has a box collider 2d attached to it. How can I calculate or check when the ball hits the top of my collider, when it hits the bottom, left and ...
0
votes
0answers
50 views

Unity 2D Game: Camera following target and looping stage

I'm with a problem and I need some help, because I'm on early learning of gaming and Unity, and i want to learn doing it, so, i need all the help, you developers know how each little help, helps a ...
0
votes
0answers
21 views

I am having problems adding Social Media to my javascript-written Game. Can anyone help? [on hold]

I have built a simple Unity3D game, and I have an idea to get my game out-and-about. By adding a share button to facebook of course. I followed all the Steps on the Facebook Developers page, ...
0
votes
0answers
23 views

MonoGame Shader - 2MGFX cant compile in SM4

am trying to compile three .fx custom shader files from a monogame sample project, i am tryting to get running for windows phone. The GaussianBlur.fx file is: // Pixel shader applies a one ...
0
votes
1answer
44 views

Loading Screen And Coroutines Unity

When I want to load another scene and show my loading screen to the user - my loading screen is a game object holding a canvas, I use coroutines, but when I type something like this: ...
0
votes
0answers
48 views

Issues with character controller (unity 4 project in unity 5)

I'm having the weirdest issues with a game me and a mate have been working on. They came up immediately after moving from the last version of Unity 4 to Unity 5. The two objects (player and enemy) ...
-1
votes
1answer
21 views

An Error Script in C# i already run without error on the display (please look first) [on hold]

Yeah When i Code the script i think its already clearn and no error but the software said i has mistake and make some class but i already put the class and run the class its still wrong heres the code ...
0
votes
1answer
37 views

How to create a smooth rotation with a constant angle?

I am trying to make a game where the player can only rotate to 4 angles. Something like this I cannot use Quaternion.Rotatetowards because the player's position is not constant, but I don't have the ...
1
vote
1answer
27 views

Handle a canvas in a windows form application

I want to create a level editor, i've started it on XNA but finally it would be better using a WindowsFormApplication. Here is the layout that i want to achieve: BLUE -> Windows form control ...
1
vote
1answer
42 views

Check for collision without any built-in collision functions

Is it possible to check for a collision between gameObjects without using the built-in functions OnCollisionEnter, OnCollisionStay, or OnCollisionExit? Preferably a solution without the use of ...
0
votes
1answer
24 views

Coding a left/right object movement C# script for android phones in unity

I have 2 spheres and a cube on screen. I'm experimenting to make a 'left/right movement script' for the cube so that when I touch the left sphere, the cube moves left-wards and when I touch the ...
0
votes
0answers
22 views

How to hide an object when a character enters it?

I have written the code for my character : void OnTriggerEnter2D (Collider2D other) { if (other.tag == "Star") { } } When my character enters or passes the 2D object, I want to ...
0
votes
1answer
18 views

Unity C# 2D Platformer Main Camera should stop on sides of level

I've been working on a 2D Platformer and i succeeded in setting up a script for my Main Camera to follow my Player gameobject using transform positions. Now when my character is near the sides (or ...
0
votes
0answers
16 views

C# Pathfinding in 2d array (procedural generation) [duplicate]

I have the following random example data in a 2d array 030 300 030 003 The 3 represents a room, the 0 represents its an empty block and 1 represents a corridor. Now i want for example the following ...
0
votes
0answers
15 views

Trouble with Inaccurate Mesh Collider

I'm stumped as to why (sometimes) when I apply a Mesh Collider to a procedurally create mesh, it is sometimes completely correct, but other times completely inaccurate. In Detail: I'm creating a ...
0
votes
2answers
53 views

Unity C# 2D Platformer Enemy Patrolling

I'm setting up a basic mario-like 2D Platformer and i'm trying to give 'enemies' a patrolling path on a platform. (just like the turtles in Super Mario Bros). All they do is patroll from left to right ...
-2
votes
2answers
52 views

In Unity, how do I make the camera follow a character?

When my character moves, I want the camera to follow them, such that the character always stays in the middle of the view. How do I do that in Unity? Here's my code right now: using UnityEngine; ...
0
votes
1answer
36 views

Creating procedural mesh with orientation

I am working on creating a procedural cylinder mesh with Unity C#. I have everything working but there is one thing I would like to implement in my existing code is to define a vector3 halfAxis which ...
0
votes
0answers
35 views

MMORPG game Server and Client with a high level communication library [closed]

I am developing a MMORPG game for Mobile (mostly windows mobile 8.1), I have written the server using Java and client side using C#. I am using JSON objects for the communication between server and ...
2
votes
2answers
68 views

How do I keep my orbiting camera upright?

I am working on code that rotates the camera around a point on the in-game map when dragging the mouse. I understand how to lock it so it stays above the map surface. However, if I keep rotating the ...
0
votes
1answer
22 views

Script attached to one button triggers other buttons too in unity

As you can see in the image above, I have 4 buttons. I have attached a C# script to only one button to change the scene on click. Now the scene should change only when I click on the button to ...
4
votes
3answers
189 views

Object-oriented Ability System?

For my RTS game's ability system, I need an efficient ability system where each ability is its own class that implements certain functions from an inherited abstract base class, Ability. Every ability ...
0
votes
0answers
45 views

Combat System For RPG/RTS [closed]

I'm working on a RPG game, and I'm stuck in an indecision loop for how to proceed with combat. I have two different ideas and can't decide which one I like more. Using a component-entity based ...
2
votes
1answer
46 views

Is OnMouseUp()'s behavior intended?

Version: Unity3D 4.6.2f1 I have a grid of tiles (Cube GameObjects with a Tile script attached). They are positioned at their index location [x][y] = (x, y, z=0) World Coordinates. Below, I try to ...
0
votes
2answers
52 views

How to Instantiate two Game Objects at the same time in Unity3D [closed]

I have two empty game objects (BlueTeam and RedTeam). The BlueTeam needs to set its opponent as the RedTeam and vice versa. When a team is instantiated it as to generate its players and place them on ...
-1
votes
0answers
28 views

XNA - How to Make Objects Stop at the Edge of the Screen While Fullscreen is enabled?

Recently, I upgraded my game to a fullscreen setting, by adding graphics.IsFullScreen = true;, but this seems to have gotten me some errors where the boundaries for movement go. This is what I have ...
0
votes
1answer
24 views

In Unity3D, what ways can I improve the batching with a single texture atlas and four-point material?

I'm building a randomized city terrain with a set of planes, custom 4 vertice square made in Blender. I've got a texture atlas working so that it draws on a single material and texture, but it's still ...
0
votes
1answer
35 views

Shmup Unity, create an enemy spread shot to the player

Following this lecture: http://www.shmup-dev.com/forum/viewtopic.php?f=6&t=347 , i created a bullet that shoot from the enemy directly to the player, in a straight line. Now i want to create 3 ...
0
votes
0answers
10 views

Unity: Set Zoom's Center XYZ point

I have my pivot/orbit camera set up: http://pastebin.com/2c7buUjV When I zoom in/out it snaps to the center of the sphere, then starts the zoom. I want it to zoom from where the camera currently is. ...
0
votes
1answer
79 views

Tower defense game structure? [closed]

I've made a simple Tower Defense game in Unity with C# scripts. Currently it only has a working Tower and some minions walking by a path to the players base, but eventually I going to add more towers ...
0
votes
0answers
32 views

Unity: Set X,Y,Z default position of camera [closed]

I'm trying to set the default value of the camera. I want it to be 5,5,-10. using UnityEngine; using System.Collections; public class OrbitCam : MonoBehaviour { //The target of the camera. The ...
1
vote
0answers
13 views

Picking up objects and dropping object in untiy2d [closed]

I want to add a functionality to make the player able to pick up certain objects and dropping them. When the player move towards the object he wants to pick up,when he picks up the object and move ...
-1
votes
0answers
30 views

Need help with understanding how methods work and various other progamming noob problems [closed]

So I'm currently working on a very small project - just a game based off of some of the things I've learned from unity tutorials. In the GameController script I have a method called GameOver that's ...
0
votes
0answers
36 views

Unity material is missing after compilation

I have a piece of code that signals the player that a projectile has hit its target. Everything works fine during the playmode, however after I compile it, it acts as if there was a missing material. ...
1
vote
0answers
64 views

Create an 2d Isometric map with tiles?

I'm creating a 2D Tower Defense game and I want it to be isometric. I'm creating it on the XZ plane in Unity(3D mode). I need the map to be based on tiles so I can seperate the monsters' path and the ...
0
votes
1answer
40 views

Instantiating on a random node, provided the node is walkable, but what if it isn't walkable?

In my demo I have a GUI where the user determines the number of AI that will spawn. I would like these AI to spawn onto the walkable area of my Grid. So I choose a random position then get the node ...
0
votes
0answers
23 views

Creating a custom collider shape in unity, and performance concerns

I want to create a custom chaped collider in unity to create point-defense triggers for objects. I have a spherical collider that triggers for attacking objects that enter it already. However I want ...
0
votes
1answer
48 views

Make my Tower continously fire at enemy while inside collider?

So I've made a Tower script in c# that spawns a projectile that then fires at the enemy gameobject. However, because I'm using the OnTriggerEnter() function it will only fire as many times as ...
0
votes
1answer
31 views

Is transform.forward mutable?

Suppose I have a GameObject, and I want it's transform.forward to be facing up. Is it possible to change it as seen below? public class Main : MonoBehaviour { void Start () { Vector3 ...
0
votes
2answers
44 views

Character on spherical terrain

My game is played on a big spherical world. Made up of a big spherical mesh with sphere collider, with 'gravity' at it's center (gravity for objects is controlled trough scripts). Now if I put a ball ...