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

Converting a GameObject method call from UnityScript to C#

Here is the UnityScript implementation of the method i use to generate a randomly tiled background, the problem i'm having relates to how to translate the call to the newTile method in c#, so far i've ...
1
vote
1answer
36 views

Align tetrahedrons

I'm currently generating tetrahedron meshes in Unity When a player clicks the side of a mesh, a new one spawns aligned with it, like this. I'm not sure how nor can I find any information on ...
0
votes
2answers
71 views

Draw a never-ending line in XNA

I am drawing a line in XNA which I want to never end. I also have a tool that moves forward in X-direction and a camera which is centered at this tool. However, when I reach the end of the viewport ...
0
votes
1answer
39 views

Problem with sprite direction and rotation

I have a sprite called Tool that moves with a speed represented as a float and in a direction represented as a Vector2. When I click the mouse on the screen the sprite change its direction and starts ...
0
votes
0answers
12 views

How to use lemodev highscore plugin for unity?

I am trying to add a server-sided highscore system to my game in unity. I have downloaded the free lemodev highscore plugin from the asset store but I cant figure out how to use it. I know where to ...
0
votes
1answer
238 views

Representing a world in memory

I'm attempting to write a chunk based map system for a game, where as the player moves around chunks are loaded/unloaded, so that the program doesn't run out of memory by having the whole map in ...
0
votes
3answers
219 views

Why are my Unity procedural animations jerky?

I'm working in Unity and getting some crazy weird motion behavior. I have a plane and I'm moving it. It's ever so slightly getting about 1 pixel bigger and smaller. It looks like the it's kind of ...
0
votes
1answer
66 views

Simple collision detection in Unity 2D

I realise other posts exist with this topic yet none have gone into enough detail for me. I am attempting to create a 2D game in Unity using C# as my scripting language. Basically I have two objects, ...
0
votes
1answer
118 views

A problem with texture atlasing in Unity

I have the texture below and I need to get rectangular parts from it. I could finally combine meshes of different quads to improve performance, but I with quads of different tilings, this means ...
8
votes
2answers
1k views

What kind of steering behaviour or logic can I use to get mobiles to surround another?

I'm using path finding in my game to lead a mob to another player (to pursue them). This works to get them overtop of the player, but I want them to stop slightly before their destination (so picking ...
0
votes
1answer
54 views

Continous collision happening in Unity2d

I am working on Unity2d. I have a game object called gameobject1 on screen. It holds an image (named "state"). When I drag a tree on a gameobject1 collision is happening continuosly in the same layer ...
1
vote
1answer
30 views

Unity Problem with colliding instances of same object

I want to check if object's instance is overlapping with another instance (any spawned object with another spawned object, not necessary the same object). I'm doing this by detecting collisions ...
4
votes
3answers
862 views

Differences between C# and Javascript for Unity [closed]

Apart from the language differences (class-based vs prototypical, strong vs weak typing), what are the differences between using Javascript and using C# when developing games in Unity3D? Is there a ...
3
votes
2answers
146 views

Using Behavior Trees and Events together

I am beginning to work with behavior trees and am unsure how events should be handled within the tree. Lets say we have a space game where the player is dogfighting with a handful of other ships, some ...
1
vote
1answer
57 views

Changing the object material without clicking on it

How can I change the object material automatically without clicking on it? The object material should change based on a timer.
-4
votes
0answers
22 views

Add button to xna Game page [on hold]

I'm developing a windows phone xna game.I want to add button to GameWindow as a Pause Button.Can i do this?.Can we use xaml for GameWindow design?.
1
vote
1answer
80 views

Moving player in direciton camera is facing

I have a 3rd person camera which can rotate around the player. My problem is that wherever camera is facing, players forward is always the same direction. For example when camera is facing the right ...
3
votes
1answer
92 views

Characters With Interchangeable Skills

I am using unity and I would like to create characters that have interchangeable spells. As an example it would be something like Pokemon that can attain different skills as they level up and the user ...
2
votes
1answer
104 views

How to impale and stack targets correctly according to the collider and its coordinate?

I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how: At the start, the falling object (in red) will fall in a ...
2
votes
3answers
68 views

How to generate arrays of item types knowing just the ratio of distribution

I'm stuck to find a good solution about spawning enemies. Think of it as a tower defense game. What I'm trying to do is: Create keypoints for enemy types and spawnrates, as Wave0 = Enemy0 * 1.0 ...
1
vote
2answers
173 views

How can I keep chase camera behind player when player rotates?

I have implemented a follow camera in Unity 3D. However, if the player object rotates, the camera does not rotate with it. To fix this I used RotateAround as follows: playerRotation = ...
0
votes
1answer
56 views

Generating a particle effect on top of a GUIElement (Unity)

I am working in Unity on a 2D project which is using C#. I have a number of guitextures which are hearts in order to create a sort of life meter. I would like when the player loses a heart for the ...
1
vote
0answers
40 views

Collisions and Lists

I've run into an issue that breaks my collisions. Here's my method: Gather Input Project Rectangle Check for intersection and ispassable Update The update method is built on object_position * ...
1
vote
2answers
703 views

How to pass an interface to Java from Unity code?

First, let me say that this is my first experience with Unity, so the answer may be right under my nose. I've also posted this question on Unity's answers site, but plugin questions don't seem to be ...
0
votes
1answer
144 views

Unity Gui from text file templates

I've been banging my head against a wall this past while over how I might create menu's and menu components in unity from text file. I would normally just build my own extended panel/label classes etc ...
4
votes
1answer
511 views

How do I achieve supersampling / anti-aliasing in pixel shaders?

I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect: But I noticed there is aliasing in my resulting image (the above image is a ...
-1
votes
1answer
32 views

Why does this code to render a triangle in SlimDX only show a black screen?

Here is the code: var elements = new VertexElement[] { new VertexElement(0,0,DeclarationType.Float3,DeclarationMethod.Default, ...
1
vote
2answers
114 views

Detecting Hitbox Collisions (Rectangle)

So I have some Hitboxes set up on 2 classes, HealthPickup and Player. public static Rectangle Hitbox; public override void Initialize() { Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32); } That's ...
-1
votes
1answer
77 views

How to add nice effects to my menu in Unity

I have a simple menu but I would like to spice it up with some of what I thought would be simple effects. I have 4 buttons that are just rectangle with some GUIText centered on the button and when the ...
7
votes
3answers
536 views

How do I translate a spherical coordinate to a Cartesian one?

Could someone point me in the right direction as to how this might be achieved? 3D math / geometry often throws me. I'm looking for something like this (ideally in C#): public Vector3 ...
1
vote
1answer
307 views

Sprite collision with color?

Is this possible? To elaborate, I am making a PacMan offshoot. Essentially it is a "zoomed in" version of the game, but the board is randomly generated. I have 11 .png files each to be used as a ...
0
votes
1answer
700 views

How to make custom shaped holes in terrain

So I'm trying to create a game where you fit certain shaped objects into the hole that fits them (similar to the young children's game with different shaped blocks) in Unity 3D. I've encountered a ...
0
votes
1answer
119 views

Rectangle touch sides of another rectangle

I am making a platformer game and im trying to make the player collide with all the blocks, here's a picture: The blocks is stored in List and im trying to get the side's of the block usin static ...
3
votes
1answer
179 views

How to compress Unity apk output?

I made a game with Unity but the size of .apk file got so large, it is about 70mb... Is there some way that I can compress my apk file?
1
vote
2answers
1k views

Octrees as data structure

In my cube world, I want to use octrees to represent my chunks of 20x20x20 cubes for frustum and occlusion culling. I understand how octrees work, I just dont know if I'm going about this the right ...
1
vote
1answer
64 views

How to create normal map from bump map in runtime?

I am using this port of libnoise to generate noise. There are several methods (Noise2D.cs, 462 and 494 line) to output images. Second one, that should give me normal map does not work completely, it ...
0
votes
0answers
47 views

Looping Background in Unity

I am currently learning C# with Unity 2D but I have come across an issue after following a tutorial. I am trying to get my camera to follow my player within the game but also to get my background ...
-3
votes
0answers
22 views

Fill the Sphere with color [closed]

I have a sphere as my game object,when I click on a button that the sphere should get filled with color.Can anybody please help me coding this out.
0
votes
1answer
101 views

Make GuiText responsive

I'm using C# code to make a responsive GuiText. I was abel to make a responsive GuiTexture, but I'm struggling with doing the same for a GuiText. Code for the responsive GuiTexture using ...
0
votes
3answers
457 views

Why does this game loop stop my process from responding?

I implemented a fixed time step loop for my C# game. All it does at the moment is make a square bounce around the screen. The problem I'm having is that when I execute the program, I can't close it ...
-2
votes
1answer
170 views

Identify mouse click unity3d [closed]

I have a 3 fbx models. I want to have each model do something when selected. But I'm not sure how to get them selected. I have managed to drag the 3 models into the scene, but from here on, I am ...
13
votes
2answers
2k views

What is the standard C# / Windows Forms game loop?

When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured? A canonical Windows Forms application has ...
4
votes
2answers
433 views

XNA 3.1 to 4.0 Vertex Shader Not Drawing

I have recently been converting our XNA 3.1 game to XNA 4.0 and am stuck on the shaders. I have the game running, but nothing is drawing to the screen, except things not using a shader. This is only ...
2
votes
0answers
58 views

How to implement simple shadows on XNA?

UPDATE: See photos below the description I try desperately to implement shadows on my XNA games. My game is a style of games like Voxel (minecraft). The problem is that I do not find support / ...
0
votes
2answers
35 views

Play animation when click on each player with in maincamera unity3d

I have 3 gameobjects player1, player2, player3, and attached script "playerscript" in to these game objects. In the main camera i have added another script called" testscript". When i click on a ...
1
vote
1answer
68 views

Why does my object instantiation work, but return null?

For some reason, the LogError runs: Player clone = Instantiate(player, this.transform.position, Quaternion.identity) as Player; if(!clone) { Debug.LogError("WTF"); } else { Debug.Log("WE ...
-2
votes
1answer
58 views

How to make healthbar decrease in unity [duplicate]

I want to build a health bar which show's the energy of the player.I have two buttons "PLAY" and "IDLE" to show the animation.when I click on the "PLAY" button the character start running along with ...
1
vote
1answer
27 views

How do I take Direct3D9 full screen using SlimDX?

I'm writing a Direct3D9 application wrapped by SlimDX. I'm trying to take my application full screen but I am having problems. I can reset the device so that it covers the entire screen, however, it ...
1
vote
1answer
45 views

XNA Library DrawPrimitives throwing primitiveCount error

I downloaded the project from here http://silverlight.bayprince.com/tutorials.php?tutorial=13 and tried adding a new OBJ file with a few thousand vertices listed. The classic teapot works but when I ...
5
votes
3answers
1k views

How can I build a game in Unity with minimum/no use of the visual editor?

I'd like to write a game completely in C#. In my search for an engine, I found Unity3D, but all the tutorials and documentation are speaking about a visual editor and the Unity IDE in which you click ...