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

Uncontrollable platform spawning

I made simple spawner like this: void Update() { if (PlatformPosition.spawnNewPlatform) { NewPlatform(); } } public void NewPlatform() { if (active) { newTransform = ...
2
votes
1answer
25 views

Respawn not working properly upon scene reload. Why is this?

So I made a respawn function and what is supposed to happen is the script it supposed to load a saved checkpoint. However I need to reset the scene (and again this worked just fine last night which ...
2
votes
1answer
17 views

Changing some color of a texture using C# in Unity

It's almost 2 days that I'm looking for a way to do this in Unity using C#, but still no luck. Imagine you have a texture with different colours (this texture can be a rug), and you just want to ...
3
votes
2answers
1k views

Unity2D: Automatic scaling of camera and sprites

I'm working on a point-and-click adventure game using Unity2D for mobile devices and possible PCs and I'm trying to wrap my head around supporting devices with different screen sizes and aspect ratios....
1
vote
4answers
40 views

How to find nearest gameobject on one side

Here is an example: The left enemy robot is closer than the right enemy robot, but I want the character to attack the robot that is closest to him on his right side. I can't use Physic.SphereCast ...
1
vote
1answer
44 views

MonoGame creates a copy of song files in XNBs location

I'm having a problem. I've been adding .wma files to the Content Pipeline app to be used as my game's background music. But today when I opened the solution/project/content/bin/music folder I spotted ...
3
votes
2answers
606 views

Preventing a Combination of Rigidbody Jump Force & Bounce Magnitude in Unity3D

I'm building a fairly simple marble racing game in Unity3D. The ball is a 3D physics object that moves only on the X and Y axes. It has the ability to roll left and right, and to jump. Pretty basic ...
1
vote
2answers
164 views

Determine facing direction mecanim 2d movement

I'm using this script to move my character in my 2d world: public float speed; //Movementspeed public Rigidbody2D rbody; Animator anim; void Start () { rbody = GetComponentInChildren<...
0
votes
1answer
48 views

Make a person walk faster when standing on plane/panel in Unity?

Is it possible to make a person walk faster when standing on plane/panel in Unity without writing a lot of code? If so how? I am using the standard asset first person movement prefab.
1
vote
1answer
44 views

How to make a temporary collision?

I have a key and door system working, the character(ball) picks up the key and when it is within the collider it sets the text("press E to open") on the screen to active so that they can open the door....
0
votes
3answers
281 views

How to access multiple 2DTexture which is assigned in Unity3D inspector panel created by an array in C#?

I am making a puzzle game, i made 5X5 cube, lets take example of orange. very left column is orange, upper with orange dot is static and lower with orange dot is also static. inbetween there are 3 ...
1
vote
1answer
32 views

Should I slow down my animation with co-routines or update the animation state?

I want to gradually stop the car animation as it collides with another car gradually speed up the car animation as it exits the collider I have two ways to achieve this. Update Co-routine For ...
0
votes
1answer
96 views

Calculate the displacement of device in unity

I'm making a 3D game in unity where the object should move forward and backward as the android device moves/accelerates in the Z axes. ie. When the player moves the devise in the direction of the +ve ...
0
votes
0answers
22 views

Unity C# - The object of type 'Object' has been destroyed but you are still trying to access it

I have a cube on a plane and I'm tring to move it to certain locations. I've baked the area and added a navmeshagent to the cube. My moving script for the cube looks like this: using UnityEngine; ...
3
votes
1answer
239 views

Local avoidance together with any-angle types of A* Pathfinding

Recently I have been implementing the Block A* any-angle path-finding algorithm in a project I have, for which I need extremely efficient results due to the large number of NPCs. However, I still do ...
1
vote
1answer
79 views

Recognizing runes drawn by user

I want to implement a system where the player can draw runes on the screen with multiple gestures. Meaning its not just one motion it can be up to 3. So far I have implemented the $P Recognizer . In ...
0
votes
1answer
104 views

How do I sync the gameobjects to server in C# unity?

I have been working on Game that consists of 10 Game Objects that have to be sync by the server values. The server decides that which game object will win and then sends command to my side(Client side)...
8
votes
1answer
260 views

Entity component system - game progression

I'm quite new to game development (but not to programming) and I'm trying to figure out what would be the best way to handle inter-world communication. What I mean is this: I've been reading about ...
0
votes
1answer
37 views

Can't access properties of a class

Sorry for the bad title, but I couldn't think of a way to word my problem for a title. So I have this script, with two classes: using UnityEngine; using System.Collections; public class GameItem { ...
0
votes
2answers
31 views

How to use prefab only when in inventory game object?

I created an empty game object named "inventory", whenever I click on an object it transfers into that game object : and I got this far with the script: //Transforms public Transform Knife; //will ...
1
vote
1answer
168 views

Store Player Stats

My character creation order is: Select Race, Select Class, Assign Bonus Stat Points, Customize and Name the character. Because I am using Unity's UI components I am using scripts attached to empty ...
0
votes
1answer
52 views

Is drawing an entire game to a render target and then scaling it up a viable solution to a pixel-mismatching problem?

To clear up some possible confusion caused by my title, my game is meant to be pixelly. I currently achieve this by multiplying sprite sizes and locations by a constant called World.Scale (currently 8)...
0
votes
1answer
493 views

What does EventSystem.currentSelectedGameObject consider the current object to be?

I've been working with UI in my project as of late and I can't figure out what Unity's event system is supposed to return for currentSelectedGameObject. if (EventSystem.current....
3
votes
1answer
77 views

Dragging text element into Text variable unity 4.6

So I was trying to make a UI element to keep score in a unity (4.6) project and I'm having trouble assigning the 'Text' element to the Text variable. So I have the text element with the script ...
0
votes
2answers
72 views

How do I make a game over screen like Temple Run or Subway Surfer?

When you die in one of these 2 games I took screenshots of (Temple Run and Subway Surfers), what exactly comes up to say "Game Over" and posts your score and all-time high score? Is it a different ...
2
votes
1answer
260 views

Handling touch input with Event Trigger

I wrote a simple script to control my 'Player' object: using UnityEngine; using System.Collections; public class PlayerMovement : MonoBehaviour { public float jumpVelocity = 10; ...
0
votes
0answers
43 views

How to make Level Editor in C# for a DirectX engine in C++ [duplicate]

I have been trying for months to make a Level Editor for my C++ DirectX Engine. I have tried using a C++/CLI wrapper or P/Invoke to do this. Neither seems to work. Can someone let me see a sample of ...
-1
votes
0answers
25 views

Error when setting DirectX HWND handle in C# [on hold]

So I am currently making a Level Editor in C# based of a C++ DirectX Engine which is compiled as a DLL. Here is the code: using System; using System.Collections.Generic; using System.ComponentModel; ...
1
vote
0answers
26 views

Unable to control trigger events for car animation collsion control

I have different car animation running on the road which have imported from max. I want to make such an intelligent System that if car start to trigger from another car it become stop. So far I have ...
2
votes
2answers
156 views

Touch taps only on very short flicks on Win7 with Monogame

I have an application on win7 which needs to support touch and mouse input using monogame. But reading touch taps proves to be a very hard thing. The TouchPanel is initialized like this: TouchPanel....
1
vote
2answers
63 views

Using my pathfinding more efficiently

I'm making a roguelike in C# with the Roguesharp libraries, in which the map can be as large as 200x200 cells. When I have an entity requiring pathfinding, I am using Roguesharp's built in pathfinding ...
1
vote
1answer
72 views

How can library classes access SpriteBatch?

I have a spritebatch in my primary game component in a game project: public class GameRoot : Game { private SpriteBatch mySriteBatch; public SpriteBatch MySpriteBatch { get { return ...
1
vote
0answers
125 views

In game replay system doesn't work correctly when animations are used on a character

I have created an in game replay system that essentially just stores each object's position and rotation at each FixedUpdate(). Once an even is triggered, the replay is then played back using ...
3
votes
1answer
376 views

Generating mesh along path

I'm currently trying to generate a path along an array of points(Vector3) This is the result i'm currently getting The dark gray points are the given path The red points are the generated verticies ...
3
votes
2answers
142 views

Traffic system in isometric game

I would like to create a traffic system in my tile-based isometric game and I would like to ask for some good approaches because I don't have a clue how to begin. Right now I have a tilemap and keep ...
1
vote
0answers
30 views

Export UnityProject inside Android Studio's existing project

I am new to the Unity3D, but I have made a small Unity project with a humanoid gameobject. I can move this humanoid with the demo data but I want to move it with the quaternion data which I am already ...
1
vote
1answer
28 views

How to Ignore Raycast for Boxcollider2D by layer or boolean?

how can I ignore Raycasting for specific object,perhaps you say use Queries Hit Trigger but when I use it Ignore all Raycasting for triggers but I want filter Ignore Raycasting for some objects I need ...
1
vote
0answers
51 views

Unity game randomly closes when phone is streaming the screen?

My Unity android game (frequently) randomly closes on some phones when it's streaming with the YouTube Gaming App for example. I have Unity version 5.3.5f1. I have to say that this phenomenon did not ...
3
votes
1answer
127 views

Trying to implement forward rendering in OpenGL

I'm working on implementing forward rendering in my 2D engine, as far as I'm aware everything should be set up correctly, I've ran into some issues earlier but I'm sure I've fixed those at this point. ...
1
vote
1answer
85 views

Problem disposing content from a screen's content manager

I have a problem with my game. I am using multiple classes for different screens, for exemple: Main Menu is one screen, When playing is another, and so on... I decided to use multiple ...
1
vote
4answers
363 views

Move ball based on direction of force?

I'm trying to make a ball that will move in the direction I push it from, and later pull it to me based on where the player is standing. using UnityEngine; using System.Collections; public class ...
-1
votes
2answers
109 views

how to create a play button and load game on play? Monogame

I need help with understanding how I can make my function work and load the game when pressing play. At the moment, when I press Play, it won't update or missing update o knowing the button is ...
2
votes
2answers
64 views

object smooth orbital limit around another object depending on mouse drag

I am working in Unity. I have special objects that can each be dragged freely around in 2d. The objects cannot get too close to other objects (minimal Vector3.distance allowed is 1.5f). I also have ...
0
votes
1answer
96 views

How to handle collision detection

So the way that I am doing the movement for my game is that you can left click a unit (which is just a rectangle object), and then it is selected. While it is selected, you can right click and that ...
1
vote
1answer
124 views

Unity Collision Doesn't Work when Two Players Instantiated

I am using Unity3D and I have a problem. I have a script which instantiates the player gameobject once you are connected to the server. I also have an attack script. When there is only 1 player on, ...
1
vote
1answer
161 views

How do I render my DirectX C++ engine to a C# Panel?

The title pretty much sums it up. I'd like to know how I can get the HWND of my C# Panel object to my DirectX engine so I can render to it. I know it involves making a C++/CLI wrapper, but I'm not ...
-3
votes
2answers
67 views

How do I write to a text file in Update function of a script? [Unity|C#]

I have a Unity C# Script which updates a variable each time the Update function is called. I would like to know how to write to a file from the update function.