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

Unity2d probably simple question c#

New to gamedev but completed some tutorials in unity but c# is still confusing. I can't figure out how to go about coding this. I'd like to input a direction on the controls then it send the player ...
0
votes
0answers
17 views

XNA Rotating a Rectangle?

I am in the process of making a giant shooter game and I have got to the point where I needed to use rectangles to detect bullets and giants hitting the player. I did that however, if you look at this ...
0
votes
2answers
27 views

How to prevent the player from calling the Jump function if no collision is detected?

I am back once again. This time with a basic 2D platformer game. I would like to allow my player to jump but only if the ground bool checks as true. I would like to fix my script so that upon ...
0
votes
0answers
32 views

Player not getting destroyed when its attacked [on hold]

I made a game in Unity 2D, it was working fine But when I upgraded from unity 4.3 to unity 5.0 some of the collider are not working properly. I made the game objects again but still the problem ...
0
votes
0answers
15 views

Portable 2D graphics library that can run server-side [on hold]

I'm in the process of searching for a fairly portable C# library that will allow me to do 2D drawing operations for generating images. Ideally the library would be able to run under ASP.NET 5. I've ...
0
votes
2answers
39 views

Rotate Character towards Moving direction

So my Problem is that my Character is always shooting in the way it is looking. Unfortunaly my solution seems to be a very bad one. I am not really cabable of aiming with my solution. Neither with ...
1
vote
0answers
22 views

Black Rectangle instead of texture

I am trying to draw a textured ractangle like in this example. But instead of a texture the rectangle is just black. Draw method: protected override void Draw(GameTime gameTime) { ...
0
votes
1answer
19 views

Unity - “SetDestination” can only be called on an active agent that has been placed on a NavMesh. UnityEngine.NavMeshAgent:SetDestination(Vector3)

I'm using Unity5 right now. I got this error when try to setDestination. "SetDestination" can only be called on an active agent that has been placed on a NavMesh. ...
0
votes
1answer
35 views

UnityException: Unable to install APK! Installation failed. See the Console for details

I got this error message when trying to build and run on Android actual device. UnityException: Unable to install APK! Installation failed. See the Console for details. ...
2
votes
3answers
90 views

What are the differences between using “GetComponent<Transform>()” and this.transform?

I've been reading some example codes and working on my own stuff in Unity. I've been seeing a lot of GetComponent, and often this will be done for the transform: Transform _transform = ...
0
votes
1answer
24 views

Making a multiplayer game on unity [on hold]

I've made a game with friends on XNA and I wanna do it in unity. I'm starting to learn it for now, made a spritesheet and did some basic movement animations. Can u suggest some site or a detailed ...
0
votes
0answers
40 views

Solution for GIT commits in Visual Studio while Unity is open?

Specifications -VS 2013 Pro (Linked with Unity) -Unity 4.6.1 -Git Version Control (Linked with Visual Studio 2013) Summary After much research, I haven't found any solutions to this fix. *While ...
1
vote
1answer
50 views

Level Data with JSON [on hold]

I am doing level data for a game in Unity with C# I have it in my game as int[,] data = { {0,1,1,0,0,0,1,1,0}, {1,1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1,1}, ...
-1
votes
0answers
23 views

How do i make a load level method that if you touch a object you move to a different level in unity [on hold]

public void OnTriggerEnter2D(Collider2D collisionObject) { if (collisionObject.gameObject.tag == "h") { Application.LoadLevel ("h12"); } }
0
votes
1answer
41 views

Shadow map depth error makes all light be covered and hidden

I've been following the tutorials listed below: http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Shadow_map.php http://xbox.create.msdn.com/en-US/education/catalog/sample/shadow_mapping_1 ...
0
votes
0answers
51 views

Camera rotation destroy scene objects orientation

I fight with that for some time and searching internet but I don't have any answer for my problem. In few words i want to have orbiting camera on screen and objects which I want also rotate ...
0
votes
0answers
50 views

Room game type logic [on hold]

I have started creating a FPS game(nothing serious), now i am facing another issue. Each can create a room(server side), server controlles AI, bullet physics and just about everything. The problem i ...
0
votes
0answers
10 views

external camera did not recognize marker in metaio

I have one problem here.I'm using metaio sdk in unity and i want to use external camera to detect marker.but my problem is, the external camera cannot recognise marker.when i switch back to internal ...
0
votes
1answer
58 views

Comparing two strings in Unity C# [on hold]

I am trying to compare two strings in C# but even though I print the strings and they are the same, the check always fails. Only one is stored in a variable and the other is hardcoded. I tried using ...
-1
votes
0answers
22 views

In XNA, how do I make a sprite move towards another?

I am making a shoot-em-up with a player-controlled sprite with a gun: I have most of the game working, but I have gotten to the point where I need to load in the enemy characters and make them move ...
0
votes
0answers
20 views

C# wall hitting problem [closed]

Hey guys so for my 2D game in order to switch levels I chose to say when my player reaches the end of the screen of the right side he will switch levels. But I have four levels and when I hit the ...
0
votes
0answers
19 views

How can I restrict rotation about the intersection point to right angle intervals?

Right now, I can draw two line segments and then rotate about the intersection point using one of the line endpoints or by dragging the whole line about the intersection point. I can scale my line by ...
4
votes
1answer
76 views

Torus World Collision Dection

I am looking for a collision detection solution for use when 2d screen wrapping. Specifically, when the image is split between the right and left side I can only detect a collision for a limited ...
0
votes
0answers
34 views

XNA C# - Unhandled exception of type 'System.NullReferenceException' [closed]

I'm making my first game (as part of my college course) and I have to make it in XNA using C#. My issue is that I'm trying to make a main menu, and after following a tutorial pretty much to the ...
6
votes
5answers
334 views

Authentication between client, central server, and player ran server

I am developing an open source game that uses a client-server scheme similar to Minecraft. We will control the central authentication server that verifies an account is valid, while players will run ...
0
votes
3answers
57 views

How to check distance between two different vectors?

So I have a very basic racing game, where I would like the car to stop once it hits the finish line. Respectively when the distance between the car and the finish line hits or goes under 0 the car ...
3
votes
5answers
1k views

Trying to implement gun cooldowns in C#

My aim is to allow my player to shoot 3 bullets at a time. Between shooting these 3 bullets the player should wait a very small interval (so that they don't all get fired at the same time) - call this ...
0
votes
1answer
32 views

Touch Input with Event Trigger. How to handle with it properly

Hello Community, Since this is my first post I wanted to say hello. As every beginner developer I have a lot of problems. Below one of them: I wrote simple script to control my 'Player' object: ...
0
votes
2answers
113 views

Basic C# Script in Unity3D for firing a bullet (not working)

working on a 2D top-down view game. Im trying to get my player to fire a bullet when spacebar is pressed. I added a component to my player (a bullet sprite) and placed it under his gun (so you can't ...
0
votes
2answers
65 views

Moving a character depending on the direction he is facing (C#/Unity3D)

Right now I have a small soldier on the screen that moves with W, A, S, D and rotates / changes direction with the arrow keys. What I want to happen is when the player's direction changes (by using ...
3
votes
2answers
93 views

Creating a countdown Timer in Unity

I want to create a countdown timer in a Unity game I am creating. Up until now my game was running for a specific time but I was using InvokeRepeating to end the game after the set time. But now I ...
1
vote
0answers
26 views

Supported Orientation, Monogame, Windows Phone 8

I am developing a game in which I need to rotate the screen on Landscape mode or Portrait, and lock it that way. In Monogame, targeting Windows Phone 8.1 adding this code: ...
1
vote
1answer
33 views

How to properly activate trigger objects?

I have made a flying cat that follows the player, but I want the cat to be a separate object. Cat is following the player and as soon as it sees a collectible it grabs it for the player and then ...
0
votes
1answer
40 views

Why is C# method not showing up for button's On Click()

I have a C# script called MainMenu.cs Here it is in its entirety using UnityEngine; using UnityEngine.UI; public class MainMenu : MonoBehaviour { public Button btnPlay; // Use this for ...
0
votes
1answer
74 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 ...
2
votes
0answers
33 views

Cannot convert bitmap to texture

I'm doing a little C# / OpenGL project and I can't manage to load textures properly. So here is my texture class : public class Texture { public String Filepath; private int TextureID; ...
0
votes
1answer
69 views

Unity 5: Accessing a C# variable from Javascript

I've set up a SQLite database with Unity. Into this I would like to add the current CPU Utilisation. The SQLite scripts are in Javascript and the method for finding the CPU utilisation is in a C# ...
1
vote
1answer
52 views

Overriding all object inspectors in Unity

How can this be done? I want to add a single label to every component( including non-misbehavior ones ) in the inspector. I've tried: [CustomEditor( typeof( Object ) )] And: [CustomEditor( typeof( ...
1
vote
2answers
80 views

Accessing a newly Instantiated Object

I currently am creating a script that allows the player character to attack by shooting orbs at foes. I have the current code to do that (not final code, for testing purposes): ...
2
votes
1answer
48 views

Does the order in which RPCs are called match the order they are invoked locally?

For example: void A() { Debug.Log( "A was called." ); } void B() { Debug.Log( "B was called." ); } void C() { NetworkView view = GetComponent<NetworkView>(); if( view != null ) ...
0
votes
1answer
93 views

Unity how to change material properties at runtime

I'm working on a unity game where I want to change the color of a material from within a script. The material applies to a line renderer. I currently have the following script: using UnityEngine; ...
1
vote
0answers
52 views

Why is my c# quadtree so slow when loaded without doing anything? [closed]

I have a WPF canvas with about a thousand DrawingVisual. I've made a quadtree for lazily loading the DrawingVisuals when they are scrolled into view. My quadtree design seems to be faulty. By just ...
0
votes
0answers
23 views

Rich Text on InputField breaks Content Size Fitter functionality. Need some help

I'm currently using the input field as a way to make normal(ish) text in Unity. Refer to this question for more detail: How do I go about making a text box that allows for highlight-able and copyable ...
1
vote
0answers
20 views

How do I manually submit a new UI InputField in code?

I need some conditions for submitting the text inside of an Inputfield, however I cannot find a way to do this via code. I was expecting something simple like with WPF or WinForms, but I cannot find ...
1
vote
1answer
33 views

User extendable content with Contentmanager

I developed a towerdefense game that uses xml-Files for almost everything, (creeps, levels, towers, upgrades). Those Xml-files define properties like textures, sounds and values like hitpoints. My ...
0
votes
0answers
17 views

Entity interpolation with a Unity listen server

How can this be done? I've implemented client side interpolation but I'm at a loss on how to implement it on a listen server. In order for the listen server player to see the same thing as the ...
0
votes
0answers
18 views

Applying Image Effect to specific texture uploaded and not to both texture and background

Hi I was following this script and shader example for brightness, contrast and saturation. I was able to follow along by attaching the C# script to the main camera and the shader to the script object. ...
0
votes
1answer
28 views

Unity 2d - Destroying foreign object from script + seek explanation about destroying objects

I have simple emmiter which sending enemies toward player in center of screen. Player can shoot missile (also emmiter). I want to destroy enemy AND missile in same time. Here is my code attached to ...
0
votes
0answers
19 views

vuforia unity how to detect that we have “ lost track of” an object

I'm working on a vuforia project and would like to be aware when vuforia can no longer detect the object in unity. Is there an easy way to write a script that is executed opon loosing track of an ...
1
vote
1answer
42 views

Find distance from Vector2 to nearest point in Rectangle

I'm setting up collision detection and I have Walls which store their positions as rectangles. I need to figure out the distance from a Vector2 to the nearest side of a rectangle. If this was two ...