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
2answers
22 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
13 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
19 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
39 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}, ...
0
votes
0answers
19 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
0answers
26 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
36 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
47 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
54 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
20 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 [on hold]

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
61 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
32 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 ...
5
votes
5answers
231 views
+100

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 ...
0
votes
0answers
22 views

Looking for inspiration for a Mafia Wars type game [closed]

I'm creating a game that is browser based and without 3D graphics. Basically its going to just be a text-based game. I'm at the very begging of this process, I want to write down a flow chart before I ...
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
26 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
110 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
62 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
78 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
23 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
31 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
72 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
31 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
61 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
0answers
43 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( ...
0
votes
0answers
33 views

Saving a c# script in a javascript variable(unityscript) [closed]

i am modifying the inventory system made by brackeys. https://www.assetstore.unity3d.com/en/#!/content/10384 Now i want to define a c# script into a variable inside the character.js file. It looks ...
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
87 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
51 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
22 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
32 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
16 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
15 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
17 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 ...
0
votes
1answer
96 views

How to move an 2D character(with animation) to mouse click position in C#?

i am going to develop a simple game called waste collection.In which if i click on a waste the character needs to walk to certain waste and collect it. Startingly the character is in the middle ...
0
votes
0answers
33 views

WebCamTexture.width and height returning 16,16 unless reinitialized

I am trying to store a picture from a camera with WebCamTexture. The function Savepicture(string path) uses a Texture2D to set pixels retrieved from the WebCamTexture class field, I end up getting a ...
1
vote
0answers
79 views

Mega-man 2 Camera help (Unity) [closed]

So I have tried several ways to fix a Mega-man 2 camera without actually figuring out a good way of doing it. So I would love if someone could give me some tips for I could solve this issue. The ...
0
votes
0answers
43 views

Trying to increase the size of a sprite when it touches a pellet in Unity with C#

This is my first game, and I'm trying to keep it simple, so just a simple platformer that works around the size of the player's character, and the character increases in size whenever they consume a ...
0
votes
1answer
43 views

finding a path from one point to another with obstacles help

Im building a tile based game and im implementing my path finding algorithm. Currently, it can find a path from point A to point B with no problems. However, if there are obstacles between point A and ...
1
vote
1answer
26 views

6DOF camera: inverted yaw and roll when orientation changes

Whenever I change the orientation of the camera, yaw and roll become inverted (or correct); the strafing, movement and pitch do remain correct however. Can you tell what is causing this and how to ...
0
votes
1answer
33 views

What can I do in Unity3D to optimize the way I'm calculating contrast of a texture2D?

I have this contrast script right now in Unity: public void ApplyContrast(string contrast) { try { double contrastD = Convert.ToDouble(contrast); //Make ...