Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [refactoring]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
259 views

Refactoring fighting game Movement class responsibilities

I'm a web developer, new to C# and trying to learn Unity. I've learned the C# syntax, I understand how to write working code, although I'm having a hard time understanding when and to what classes ...
Adam's user avatar
  • 3
2 votes
1 answer
2k views

Right way to get reference from across scene object in unity

I need a reference for the game-object from another scene but the problem is that the scene object by default is off. So I thought that I should place its reference in another script and get a ...
Muhammad Faizan Khan's user avatar
3 votes
1 answer
1k views

How to reference nameof private serialized field in unity custom inspector

I'm running into a problem that I think will seriously affect maintainability down the road, so I'd like to figure it out now before it becomes a problem. I've been starting to use private [...
Adam B's user avatar
  • 800
0 votes
1 answer
842 views

OpenGL glVertexAttribFormat vs glVertexAttribPointer

I am attempting to change my code from using glVertexAttribPointer to glVertexAttribFormat as I have heard it;s more efficiend ...
Makogan's user avatar
  • 260
43 votes
6 answers
8k views

When is the best time to consider performance?

I am coming from software development background. During the software development cycle, we usually focus on functionalities and the working product. At the end of development, we start optimizing ...
Emad's user avatar
  • 1,126
0 votes
1 answer
126 views

How to manage instances of (placed) cards and decks in card games?

This question sounds quite specific, but I mean in general, how do you manage something like a card game when it comes to decks (one for player1, one for player2, ...) and placed cards focused on ...
nitwhiz's user avatar
  • 47
1 vote
1 answer
1k views

Unity storing many items in an RPG game

I want to ask about the best method of storing data that represents information's about specified objects. I want to find a better way to storing somewhere items in my RPG game before problems had ...
Michael's user avatar
  • 119
14 votes
1 answer
1k views

Is * calling *= (or *= calling *) slower than writing seperate functions (for math library)? [closed]

I have some vector classes where the arithmetic functions looks like this: ...
user112513312's user avatar
1 vote
1 answer
415 views

Inherited property in derived class reference only base class

[Context] I am developing a game in Unity, and wanted to make a Game Manager. Like many examples out there, it uses a Singletron design pattern. But i have several other Managers, all using Singletron ...
Romulo Rocha's user avatar
1 vote
1 answer
189 views

How can I refactor an enum so that it is still available in the inspector?

I am trying to use an enum so that it is available in the inspector. This code works: ...
Evorlor's user avatar
  • 5,793
1 vote
2 answers
927 views

Handling differing inventory items on use interactions

Hey there my fellow programmers. Looking for a little input into a potentially smelly code problem (I was about to post this on the Code Review SE, let me know if that's the more proper place). After ...
steve's user avatar
  • 220
2 votes
2 answers
4k views

Would it be more efficient to handle 2D collision detection with polygons, rather than both squares/polygons?

I'm working on a 2D game engine and I'm trying to get collision detection as efficient as possible. One thing I've noted is that I have a Rectangle Collision collider, a Shape (polygon) collider and a ...
KleptoKat's user avatar
6 votes
1 answer
938 views

How can I refactor "attack cooldown" into "attack speed"?

I'm building a game where the player's character can attack bad guys and vice versa. I built this with the concept of an "attack cooldown" because I don't want units to be able to attack each other ...
Daniel Kaplan's user avatar
1 vote
6 answers
203 views

When is a good point to revise a project? [closed]

I am currently working on a project. Some time ago I realized that I do achive my goals but the more code and prototypes I add the more I feel like there is no going back. For example some of the data-...
チーズパン's user avatar