Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [unity3d]

Unity, also referred to as Unity3D, is a cross-platform game engine with a built-in IDE developed by Unity Technologies. It is a commercial development platform for creating games, interactive 3D applications, training simulations, and medical and architectural visualizations.

6
votes
3answers
188 views

Rock Paper Scissors coding challenge

I did a job application to a Unity developer position and i was given a coding challenge which was implementing a Rock Paper Scissors game or a variation of it. I have implemented the game using Unity ...
5
votes
1answer
197 views

Non-blocking TCP and UDP in Unity3D Game Engine

I would like constructive criticism of a networking plugin I've written for Unity 3D. The use-case of the code is for people in "creative coding," where simple TCP and UDP messages are used for ...
3
votes
2answers
158 views

C# Unity Object Pooling (for a shooter game)

I am currently developing a Bullet Hell (shoot-em-up) game for my school project. I have implemented Object Pooling for my game to recycle mainly bullets. (Though I could use it to recycle enemies in ...
3
votes
1answer
103 views

Saving allowed positions from a 3x3 matrix

I wrote the next code chunk to save all the allowed positions from a 3x3 matrix, it's working but I think it could be better. Besides something similar happens in my Randomizer class, although I admit ...
2
votes
2answers
66 views

Class for handling player movement and / or similar behaviour

I am currently developing a Unity-based multiplatform game (PC, iOS, Android) in a small team. This is the code we have created for the character actions inside the game. I am looking for feedback on ...
2
votes
0answers
63 views

Generic DialogueBox class with different parameters

I have implemented a DialogueBox class which can be static, singleton, service locator, etc. I have written it as a singleton pattern and implemented it in Unity3d engine. It is a part of a game. I ...
5
votes
0answers
73 views

Prototype GameManager for game written in Unity

I am self taught, so I'm consistently seeking ways to code better, and more efficiently. If anyone has the time, please advise me on what can be done better with explanations as to why the old method ...
4
votes
1answer
171 views

Offline .io style game built in Unity

I am creating a .io style game through Unity and it's coming along nicely. This is my first time working with Unity, and my first time using C#; I have been a Java coder. Could you good people tell me ...
2
votes
0answers
108 views

Unity Generic Pool System

So i'm using this for pooling my gameObjects in game. Every other script can ask for a pooled GameObject using ...
0
votes
1answer
64 views

Generating a QuestionID Using a Nested Loop for a Quiz Game

So I started learning OOs and code refactoring and decided to do some project. It just some simple quiz game. Here are some mechanics There are 3 sets Each set have 8 Brands (types) Each brand have ...
2
votes
0answers
49 views

Task based GameObject recorder for networked game

I've recently been dipping my toes in to async code so I'm not 100% sure if there's a better way to do this, or if I'm going to run into problems down the road. I plan on using the following class in ...
0
votes
1answer
50 views

Flip Sprite using the SpriteRenderer component

I want to create a 2D topdown game with Unity. When moving the player I also want him to rotate. Most tutorials provide a solution changing the localscale of the transform component on the x axis ...
3
votes
1answer
88 views

World resource system for Adventure Game/RPG

I'm beginning the long process of developing an Adventure Game/RPG and I was hoping to get some review on a resource system I'm coming up with. How it works is, a resource is generic to every ...
1
vote
0answers
34 views

Unity Multiplayer Authoritarian Client-Server

I have created a client-server system which handles multiplayer for a game I've been making with Unity. Problem is, it feels very clunky and complex and I want to know how the design could be ...
0
votes
1answer
88 views

Tycoon-style Idle game

I am creating an Idle game right now (tycoon style) which has 9 trains, (8 of them needed to be purchased), and 1 is always active, no matter if you just started the game. I was trying to create a ...
5
votes
2answers
96 views

Custom data type - “Binary” Float (0-1.0)

In my current game I have the need for values ranging from 0 to 1, or from -1 to 1. The values should never exceed this threshold, so instead of constantly validating the values I made a custom data ...
7
votes
0answers
137 views

HoloLens Unity program

I recently finished writing an HoloLens proof-of-concept program. It involves generating a user interface based on a connection with an OPC server. OPC involves industrial PLCs, one or more PLCs send ...
5
votes
1answer
1k views

A* Algorithm in C# for pathfinding 2D tile grid

I am very new programming and am trying to develop a small tycoon game as a hobby project in Unity. This algorithm executes beautifully but if 100+ agents are getting new paths simultaneously there is ...
6
votes
1answer
82 views

Object creation pattern for component classes

I've been grappling with Unity's architecture for the last few days, trying to work around the fact that you can't use constructors for your MonoBehaviours (and by ...
0
votes
4answers
156 views

BestHTTP asset download

I'm using the asset BestHTTP in unity and I'm downloading a few image from amazonaws to use as texture. It used to be one image, but now I have a few. I was not able to shorten it. When I'm trying ...
1
vote
0answers
150 views

Executing a sequence of actions over time in Unity

This script executes a sequence of actions over time and is based on the methods exposed by the UrhoSharp framework. I am new to Unity, but well acquainted with C# so I know what I'm doing for the ...
7
votes
4answers
279 views

Call a method from all GameObjects implementing a specific interface in Unity

my player has a gun with 3 bullets. If he runs out of ammo the scene should reset itself. I don't want to load the scene again, some components should reset themselves by using an interface. So my ...
1
vote
0answers
158 views

Unity Tilemap RandomBrush with orientation and probabilities and fixes

Unity3D.com recently released a 2-D Tilemap system. It comes with a really basic RandomBrush for painting a random tile from a list of tiles. But the tiles were not being saved between preview and ...
6
votes
1answer
1k views

Tic-Tac-Toe AI in C# Unity

So I have a working game of Tic-Tac-Toe with an AI that plays random moves. Is anyway to maybe shorten the endturn() function so it's not so long? Also is this set up well enough to add a mode where ...
5
votes
1answer
80 views

Handling float discrepancy in Unity3d

I know there are thousands of posts and questions around the topic of Float Discrepancy. And this is not really a question but a discussion for it. After sitting ...
6
votes
2answers
116 views

Sims-style walls part 2: Flood fill

A follow up to this post. I've ported all of it to Unity, and generally cleaned it up a little, but looking over the code, the code for flood filling is messy and repetitive. Here's a visual of how it ...
1
vote
0answers
37 views

Touch Controls: Assigning Touches to Movable Objects within Rects

My game has a variable amount of vertically placed sectors (fields), each of which contains a cursor that moves up and down along a bar when the player touches within a given field. The sectors are ...
3
votes
3answers
141 views

4 level deep of For loops for counting objects

I'm just going to ask about this 4 Level Deep For Loop of Mine though i put it inside of the StartCoroutine(); Here is my code : please don't judge me yet ...
6
votes
2answers
584 views

Ability System Implementation

I'm making an RPG in Unity with an ability-based combat system, think Guild Wars 2 or World of Warcraft. I'm implementing abilities in an inheritance tree structure which makes creating multiple ...
2
votes
1answer
62 views

Jumping Game for iOS and android

I made this game called Jumpol, about you trying to jump over as many obstacles and collect as many coins as possible. The coins can be used to change your ball and revive yourself so you get another ...
6
votes
2answers
158 views

Model-to-Prefab mapper and factory

I am creating a fluent interface to build user interfaces in the Unity game engine. As a subcomponent of this library, I have a set of objects called Components (e.g. Panel, Button, etc) that I want ...
1
vote
0answers
127 views

Grid based inventory

I am trying to create a grid based inventory and so far everything is going well except for one thing. The inventory consists of Grids that are built of ...
3
votes
2answers
134 views

Improving Game EventSystem

There is a Unity EventManager class from Unity tutorial that allows events to be registered, unregistered and invoked. The bad side of that ...
4
votes
1answer
55 views

Transferring many Vector3 across network ten times per second

I am making a game with C#/Unity, and have devised a Client-Server system to update the positions and directions of all units in play ten times a second. My biggest concern is that the more units ...
3
votes
2answers
2k views

Slot Machine game

Below is some part of a slot machine game that I have made using unity. I always work alone and I know I poorly comment. I also feel insecure putting this on github and show it to potential employers ...
2
votes
0answers
44 views

Getting right model from list

Im not a programmer, but somehow like trying to make something, almost like a hobby. As of now i have made a list of different gameobjects (models) and i need to choose right one from that list. ...
1
vote
0answers
86 views

Getting data from a server for raffle game and saving data back to the server

So I'm making a raffle game so when you press B you get a random name with all the information of the winner. I get the data from a local SQL server and I want to make a list of the winners by saving ...
1
vote
2answers
102 views

Materiel position query for a war game written in Unity

I am making a tank game. I have a database on a server where I store information about Tank itself, Hulls, Turrets, and Guns. When the server gets "Hull" request it returns all needed information ...
4
votes
0answers
119 views

Endless Runner Platform Sequence

I need some help/critique on some logic I am trying to figure out. What I have feels a bit messy and I wanted to reach out and see if there is a better way to approach this. I am creating a ...
6
votes
2answers
224 views

Multiplayer Peer-To-Peer position interpolation

I have coded this movement interpolation for Unity3d using Photon. OnPhotonSerializeView gets called at the tickrate. Any kind of criticism/improvement suggestions are welcome. I tried to make the ...
1
vote
2answers
78 views

Does checking for the Core.Instance.isLocalPlayer twice in my method constitute a bad design?

I've been writing some code for my unity project, where I am connecting players to a game and adding them to a dictionary, which is in a Database class. I have a simple method which is adding them to ...
8
votes
1answer
247 views

Game involving a squirrel and falling projectiles

I did this game as part of a game jam and I was hoping I could get some pointers on how to improve my code. I feel like the code is sloppy but have no idea of the correct way to do something. Whilst ...
1
vote
1answer
97 views

Compare 2 List<T> to get a List with active players

I have a little problem: I have a list with all the users that have logged in the game and a list that has all the names of the active players and I make a List with all the players as a ...
2
votes
2answers
180 views

Building a simple random equation of size

I'm trying to find a way to make this code more efficient than using a lot of if statements because there are a lot of combinations. The final result variable is an ...
5
votes
1answer
116 views

Code for movement controller of the player in Unity

I am writing code for games in Unity. I should write the part very often and would like to know the flaws of the piece of code. It seems like everything is fine, but nevertheless I feel that some ...
2
votes
0answers
25 views

Unit sprint mesh rendering

I have built this code in the past and I am reviewing it once again. I have a feeling that I could make the code much faster. Could someone please look at the code. What happens is that every time ...
3
votes
3answers
112 views

Get closest Entity from the Player on a 2D battlefield

I am building a little game in using Unity, and recently made an algorithm to get the closest Entity to the player on the battlefield. I made a working sample in ...
3
votes
1answer
138 views

Simple code for calculating damage increase

In my little game project, I have the following piece of code, in the static class DamageHelper, that takes a Spell, and returns ...
3
votes
1answer
59 views

Generic FPS movement controller with Xbox One controller support

I'm currently working on an FPS shooter game and I needed a generic movement controller that supported both keyboard and Xbox One controller input. My main goal in designing this controller was to ...
4
votes
1answer
331 views

Perlin Noise terrain in Unity3D

I've recently had time to devise another program so this time I decided to write the Perlin Noise algorithm in code. I have succeeded and the code works but I can't help but feel that my practices ...