5
votes
Accepted
Does abstraction influence performance?
It looks like you don't really need to ask "Does abstraction influence performance?" - because you did one better: you tested and measured it! "The problem I am facing with version 2 is that the game ...
3
votes
Accepted
What is the best practice for creating a system of platforms that does not use Unity's tag system?
Depending on the level of complexity required you could go one of two routes:
If you have a set of GameObjects that represent the different block types and all you need are a set of properties to ...
3
votes
Should a CharacterBody3D be the root of a character, or a child node?
It is purely personal preference. When I develop in Godot I take the approach "make it work then make it better". So I would probably start structuring my scenes in the simplest way possible,...
2
votes
Accepted
Instantiating, Inheritance, Objects and Children basics in Unity
if I make a c# script "BlueEnemyScript" inherit from script "EnemyScript", that's a "child object" in c#?
No, when you define something like ...
2
votes
Accepted
Destroyed GameObject but still trying to access it(C# Unity)
I'll answer my own question . What i did here is that this line of code
...
2
votes
Unitys [SerializeField] and parallel inheritance
It looks to me like you might actually want an IItem interface, or abstract class, a bit like this:
...
2
votes
Accepted
Why can't this event call its parent event?
Answered my own question within minutes of asking.
How I created this problem
When overriding parent events in Unreal, you must right click and use the context menu to add the event you want to ...
2
votes
RPG Item Design
Similar to the answer to the question referenced by Philipp, you might consider using a general system of events and flags for every item:
CanEquip, OnEquip/OnDeEquip
CanConsume, OnConsume
IsQuestItem,...
2
votes
Accepted
How to inherit from a custom node of a gdnative plugin, in gdnative?
At some level we could argue for Godot being data oriented (e.g. the code inside the "servers", such as VisualServer and so on), or we can argue that the ...
2
votes
Making unity inspector accept classes that inherit from a base class
I'm unable to reproduce the problem described in this question when using types that are derived from MonoBehaviour or ...
1
vote
Interactable actors should be implemented via components or inheritances?
There is another option, make all Actors implement the IInteractableInterface interface by default (and remove that interface from the hierarchy) and use a ...
1
vote
How should I implement the idea behind this abstract class setup in a Unity-Friendly/Inspector-Usable way?
One simple way to get this behaviour out of the box is to make your FieldGeneric3D inherit from ScriptableObject:
...
1
vote
How should I implement the idea behind this abstract class setup in a Unity-Friendly/Inspector-Usable way?
One possible solution is that instead of having it as a field in this class, have it as a separate monobehaviour component that inherits from an abstract class or interface. You can then get a ...
1
vote
Accepted
How to inherit of a scene tree structure in a way that a change in the ancestor is updated in the descendant?
You can make an inherited scene. From the "Scene" menu, select "New Inherited Scene…" and pick the base scene. Then apply the modifications you need (e.g. change textures).
There ...
1
vote
Accepted
Can I add extra widgets to a child widget in UMG-UE4?
You need to use an overlay which will allow you to put multiple widgets onto one widget.
1
vote
How to call StartCourotine in abstract class?
I'm unable to reproduce this problem. Testing with the following AbstractClass:
...
1
vote
Accepted
C++: Setup the basic Update function in different classes which all derive from GameObject
You'd want to use polymorphism.
In your case :
...
1
vote
Use GKEntity's component(ofType:) with inheritance
Well it appears as if no one here seems to know it so I'll just post what I used which is a new method that I added in an extension to GKEntity (which I was ...
1
vote
Accepted
1
vote
Best way to implement a class or interface for a set of UI buttons that only differ in their Draw() function?
If you distinguish these button types by making derived classes for each, I would have the AbilityButton class have an abstract Draw() function and each of the derived classes would then implement the ...
1
vote
Accepted
Heir Class Constructor Throws CS7036 "No Argument Given" Exception
By default, when new SpecialAttack() is called, before the SpecialAttack() constructor is hit, parent constructors are hit.
The ...
1
vote
C++ inheriting functions problem
Java is object oriented, that is, it makes heavy use of inheritance, but the syntax is a little different.
In C++ we declare a base class, which can be viewed as an interface, thusly:
...
1
vote
Accepted
C++ inheriting functions problem
In the future, make sure to write the error the compiler gives.
In c++, for a function to work, you need (generally) two things: a declaration, and a definition. (In some situations, both can be ...
1
vote
Accepted
why child class can access object while parent can't
Since I used a start method too in the child class I should have written it that way
override protected void Start()
{
//some code
base.Start();
}
and in ...
1
vote
XNA: Classes with Texture2D to be treated as one
You can either just extend Texture2D, which would allow you to cast it down to a Texture2D if you want or (in my opinion preferably) extend the spriteBatch with a draw that accepts Animations.
To be ...
1
vote
Accepted
Interact with inheriting class methods from "casted" base class (collisions, etc)
In Unity, I'd generally recommend working with the principle of composition over inheritance.
In this case, if player characters, enemies, and environment objects all need to take damage, then damage-...
1
vote
How to expose a child node’s texture from the parent in Godot
Let us start with your code:
...
1
vote
Accepted
How to expose a child node’s texture from the parent in Godot
I would export the texture variable from the root node and simply set the child texture in _ready(), rather than mess around with getters and setters.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
inheritance × 65unity × 23
c# × 21
c++ × 13
java × 8
oop × 5
godot × 4
sfml × 4
libgdx × 3
architecture × 3
unreal × 3
rpg × 3
design-patterns × 3
component-based × 3
gameobject × 3
interface × 3
polymorphism × 3
xna × 2
game-design × 2
unreal-4 × 2
software-engineering × 2
optimization × 2
character × 2
serialization × 2
monobehaviour × 2