Questions tagged [unity3d]
The unity3d tag has no summary.
23 questions
0
votes
1
answer
80
views
API design with conditional compilation: stubs and exceptions vs public API change?
I am developing a package for the Unity game engine. I want to add additional functionality to my package if another specific package is present. I am faced with a dilemma I am not sure which of these ...
0
votes
0
answers
327
views
Unity ScriptableObject vs Abstract class for Spells
I am trying to create a spell casting system for an auto chess game.
I find myself not knowing which direction to go in my design. I started out with a Spell as a scriptable object that contains a ...
1
vote
1
answer
810
views
State machine - how to handle outside environment values?
I've got a state machine implementation in Unity that I'm working on (C#), the plan being that it will be mostly used for AI related things.
I'm not sure how I should deal with various "inputs&...
0
votes
1
answer
320
views
Is it ok to Inject a whole object instead of only the dependencies
I'm working with the Dependency Injection Pattern in Unity3D (an engine which uses MonoBehavior, a class that doesn't have a constructor, as the base class for all of its game components), and I ended ...
1
vote
2
answers
287
views
Avoiding duplicate code between the player and npc classes deriving from Unity's MonoBehaviour
These would be the base classes like Npc and NpcTask.
public abstract class NpcTask
{
public Npc Npc { get; private set; }
public NpcTask(Npc npc)
{
Npc = npc;
}
public ...
-3
votes
1
answer
54
views
Do you recommend having a template scripts?
I am pretty much new to programming, but recently I began to learn C# intensively for Visual C# and for Unity. I have noticed that I use many scripts that have absolutely the same content in different ...
-2
votes
1
answer
93
views
Are These Both The Same Or Different If Statements [duplicate]
This is for unity
I tried another way of stopping player after he dies and it worked fine but now it does not work with sounds
That was my way the only thing that I changed is the state
Ben's was
...
4
votes
3
answers
558
views
How to do grid systems with floats given precision causes problems
I've been trying to create a grid system that can use any grid size and start at any given anchor point rather than always at 0,0.
The problem however is imprecision makes it impossible, even the ...
0
votes
0
answers
205
views
Most performant way to store and find overlap in (coordinate, id, time interval) triples
Let me explain what I'm doing.
I have a grid based on integer coordinates like (5,5), (5,6) etc., and I have an algorithm FindCells that generates a list of (coordinate, interval) tuples. These ...
0
votes
0
answers
2k
views
Inherit a class that inherits a generic class to make it easier to read
I'm creating a simple Dependency Injection library for Unity (no constructors available) and I want to use a generic class that implements a generic call for each class that would inherit it allowing ...
3
votes
1
answer
200
views
Transforming a long-running operation into a step by step operation?
I am working on a video game in Unity and at some point I'm facing a tough problem to solve:
The game freezes while loading level data.
Let me lay down what's happening in that process that takes a ...
1
vote
1
answer
162
views
Handling multiple game modes with a game controller
I have a basic GameController with a finite state machine to handle game logic.
I'm adding game modes and coming across problems cleanly implementing them. The core functionality of the game stays ...
4
votes
7
answers
2k
views
Sync one thousand vector3 across network with minimal bytes?
I am making a game with Unity, and am having problems attempting network synchronisation. Deterministic simulation is impossible because Unity's internal logic is float based. I am trying to make a ...
4
votes
1
answer
349
views
Between JS clients and a Unity game server : TCP or UDP?
I'm currently building an interactive game which has a very special use case : The game is displayed on a giant screen on stage in a theatre, and the audience can play it with their smartphones (http:/...
1
vote
2
answers
1k
views
Test a wrapper to external static/singleton
I am integrating an external library that declares a singleton, like this:
public class External : MonoBehaviour {
public static External Instance { get {/*setup inner stuff*/} }
public void ...