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

Mega-man 2 Camera help (Unity)

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
11 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
12 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 ...
0
votes
1answer
15 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
8 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 ...
1
vote
2answers
38 views

Basic multiplayer matchmaking implementation

I am currently writing a matchmaking server application for a 5vs5 UDK game. Here is the scenario on which I built my code: The player starts the game and authenticate The player clicks an huge ...
0
votes
1answer
12 views

Unity - How To Customize Buttons Graphics

inside my buttons I added some variables (as you can see in the code below). public UnityEngine.UI.Text itemInfo; void Update () { itemInfo.text = itemName + "\nCost: " + (costo_stringa = ...
0
votes
2answers
31 views

I am having problems with my delta movement

Below shows the code that I currently have: decimal far = 50.0m, medium = 30.0m, near = 10.0m; // tweak this decimal slow = 10.0m, fast = 20.0m; // tweak this var x = WhiteBallRectangle.X - ...
-2
votes
1answer
11 views

how to change trail renderer start width dynamically by script in unity?

I created a prefab that contain a trail renderer to make a drawing sprite in GUI, then i put it into a gameobject in a script. I want to change the start width or end width of the trail renderer ...
0
votes
1answer
34 views

How do I make the ui button to move my character?

How do I make my character move left,right and jump when click ui buttons using this code ? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public float maxspeed ...
0
votes
0answers
17 views

How do I make Ground Check stop rotating with the character when it rotate?

How do I make my character routice without Ground Check rotating with it, but still follow my character? Code: using UnityEngine; using System.Collections; public class Player: MonoBehaviour { ...
2
votes
1answer
28 views

How can I use a lookup table for brightness and contrast in Unity3D?

Currently, I implemented a rudimentary brightness and contrast algorithm that changes brightness and contrast pixel by pixel. This was super inefficient performance wise and the algorithm looked a bit ...
2
votes
2answers
47 views

How do I calculate rotational impulses in rigid body collisions?

I'm writing a simple 2D physics engine to help me understand the inner workings of physics engines. I'm following Randy Gaul's tutorial which can be found here and It's been extremely useful and ...
0
votes
1answer
13 views

Unity - Scroll Rect shows buttons outside of the rectangle

I have this problem. I'm using a scroll rect to display a series of buttons, but I would make sure that as soon as the buttons (with the scroll rect), come out of a certain area (bounded by a panel), ...
0
votes
0answers
16 views

Character fixed angle?

I want my character to rotate so I turn off fixed angle in Rigidbody 2D, but the problem here is that I can't jump in any other angle except for the angle where I have my groundcheck. Can anyone help? ...
0
votes
1answer
21 views

Send a prefab over network in Unity

I want to instantiate an object on only the server and one client. This means Network.Instantiate is out of the question and I have to instantiate it manually. Since Network.Instantiate takes a ...
0
votes
0answers
32 views

Character can't jump in other angle with fixed angle off

I turn off fixed angle so my character can rotate, but it can only jump in 1 angle but I want it to jump in every angle. How do I do that? Code: using UnityEngine; using System.Collections; public ...
0
votes
0answers
18 views

2D Physics library for C# [on hold]

I'm currently in a C# project where I need to simulate some 2D high school physics such as inclined plane with and without friction, projectile motion, pendulum, collisions, etc. The user should be ...
0
votes
0answers
28 views

Texture Editing with Multhi-Threading

So I have this giant Texture2D(4096 * 4096, don't ask why) and all its data stored in an array of Colors. When I hit left MouseButton I create a blue 64 by 64 square at the cursors position using the ...
0
votes
2answers
54 views

Enemy fire every few seconds

Hi I'm trying to get my enemy to fire once every few seconds, I tried using a Coroutine but due to me essentially calling the Coroutine through the update method, the Coroutine is repeating every ...
2
votes
2answers
26 views

How can I load textures in Unity and keep them between scenes?

I have some textures that are used in multiple scenes and I want to keep them in memory to speed up load times between scenes. I know about Resources.Load, but does that always keep it loaded? If a ...
-1
votes
0answers
18 views

Unity Change GameObjects Color C#

Hi so I am currently messing around with changing a game objects color, and I found this code online to do it.. pickedNumber.gameObject.renderer.material.color = new Color(255, 0, 0, 100); But I ...
1
vote
1answer
14 views

Broadcast message to Parent Gameobject and Siblings in Unity

I wish to broadcast a message from one object to it's parent and it's siblings. I am aware that unity does not support broadcasting a message to all other game objects but is there a way to broadcast ...
1
vote
1answer
40 views

Proper way to divide a 2D climbing animation in Unity3D

I've got a 2D character that's going to climb up a 2D tile to his left or right and I've got a climbing animation consisting of three parts essentially: Animation for the character going from ...
0
votes
1answer
72 views

How would I check the range against the entirety of an enemy object, and not just it's transform.position?

I want to be able to do range checks against the entirety of an enemy object, and not just it's transform.position. The enemy object can have it's side or nose within range, but range detection will ...
0
votes
2answers
26 views

Implementing a delay timer into triggered method

I have a shoot method that is used as a mouseDown() Trigger on my player. I am wanting to introduce a delayTimer but am unsure of how to do this within the method due to the trigger. public void ...
1
vote
0answers
36 views

Unity - How to save variables for Android Game?

This is my current code, it only work into unity, when i test it in an Android Device it don't save the variable public class Click : MonoBehaviour{ public UnityEngine.UI.Text proiettiliTotali; ...
1
vote
1answer
52 views

How to use polymorphism with the Unity editor

For example: [System.Serializable] public class A { [SerializeField] public int x; } public class TestA : MonoBehaviour { [SerializeField] public A a = new A(); } ...
0
votes
0answers
28 views

Unity: Issue With Moving Game Object To Another

I am currently trying to send a ball to a target location. The program randomly chooses another game object and tries to send the ball its location. But the ball currently moves very little and ...
0
votes
0answers
31 views

unity how to make an animation reverse mid way through

I have a animation of several parts moving (think bridge) and would like the animation to reverse mid way through if a certain condition is modified (function call). I have the Animation and the ...
0
votes
0answers
28 views

Unity Rigidbody click to move issue

I'm wanting to have a script that when I click in my scene, my player will rotate and have a force added to it and will travel until it has reached the clicked point in my scene. Right now I have it ...
0
votes
0answers
50 views

Smooth player movement in a tile map based engine

The character is moving too much fast, it teleports! Note that a tile is 80x80. Each cell has 4 bools to say if you can go up, down, right, left. Am I doing something wrong with Lerp? This is the ...
0
votes
1answer
125 views

How do I make my character jump in every direction?

My character can only jump when he is grounded, but he can only grounded in one direction I want him to jump in every direction, can anyone help? CAN JUMP : CAN'T JUMP : Code: using ...
1
vote
0answers
27 views

Array of script class references in inspector

I'm trying to remove the Reflection part of ones of my scripts so it works in WebGL, however I am having some trouble. Basically I need a way to store references to classes in an Inspector array so ...
0
votes
0answers
27 views

How do I make my character jump in any position? [closed]

My character is a square which can jump in position x and y but I want it to jump all position How can I do that? Code: using UnityEngine; using System.Collections; public class Player: ...
0
votes
2answers
54 views

A 2D Camera Follow Script That Does Not Rotate?

I am attempting to make a 2D racing game. So far I have a player car (sprite) and a main camera. I would like to know how to make the main camera follow the player car while still showing signs of ...
0
votes
1answer
33 views

Given a constant rotation and target point, find position so that point will be in camera center

Given a fixed rotation and a target "center" point, how to I find the position the camera should be in so that that point is the center? LookAt changes the rotation keeping the position constant. ...
2
votes
1answer
39 views

Multiple enemy collidiers

I currently have an enemy that upon collision kills the player with a kill script, I want to add another collider that acts as the visibility radius for said enemy. However, when adding another ...
0
votes
2answers
123 views

How do I make my character jump in any angle?

My character is a square which can spin in any angle but it can not jump in certain angle Can anyone help? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public ...
1
vote
2answers
101 views

C# comparing alot of elements

Im making a small game in Unity(using c#) basicly what I have there is each player chooses one Damage Spell or one Shield Spell.and the thing is that the number of combinations is huge. like 100 ...
1
vote
1answer
71 views

Physics not working when game is running on device Unity

I have my bouncing ball game. The ball bounces up when it hits the ground and when it hits the left wall it changes direction to right and when it hits the right wall it changes direction to left and ...
0
votes
1answer
80 views

Actually Implementing “C# as a scripting Language” in XNA

Following an example from this thread, I've made an application that dynamically loads in C# "scripts" (actually, plugins) into my game -- but I've hit a snag: how do I reference the assemblies for ...
2
votes
2answers
26 views

Unity2D Sprite flips camera when moving left and right

I am using the Unity Engine and coding in C#. I have a sprite as a parent with a main camera as a child so that the main camera follows the sprite. However, when pressing 'A' and 'D' to move the ...
-1
votes
0answers
35 views

Where should I start individual development? [closed]

I'm not completely sure if this is the correct place to post this, but I need some guidance. I'm 15 years old, and a sophomore in High School. I want to either be an electronics technician or a game ...
-4
votes
0answers
23 views

C# Game with Windows Forms Graphic [closed]

Hi i'm making simple c# game , and I like opinions is it good for a beginner Here is the link of the game . (link removed) Feel free to give your critical opinion
1
vote
1answer
40 views

Whats causing this weird texture stretching on my mesh?

Making this mesh via code and the texture seems to only tile on the sides, but not on the top. Any idea whats going on? public class CoreMeshCreator : MonoBehaviour { //Initialization public void ...
0
votes
0answers
35 views

XNA 4.0 - Using premade .xnb font files

Basically, for our college project, we need to use a font in xna. The only problem is that we are not allowed to install it due to admin rights. Is it possible to use and load the .xnb file that gets ...
-2
votes
1answer
42 views

How do I make my character run infinitely? [closed]

I got my character running right (can't run left) and jump but I don't know how to make him run infinitely can anyone help? using UnityEngine; using System.Collections; public class Player: ...
1
vote
1answer
62 views

How do I make my character stop going left? (Unity)

So I have this code and my character can go left, right and jump. I don't want the character going left , so how can I remove that. (I'm very new with coding) using UnityEngine; using ...
3
votes
1answer
89 views

Determine if an object is inside a ship's turn radius, rotation via torque

I have a 3d space game where all ships move around using physics. I am trying to determine if a given object is reachable by a ship at a given velocity and turn radius. I believe the formula for turn ...