Questions tagged [game-component]

The tag has no usage guidance.

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

disabling or enabling a public component

I need to be able to disable only a specific component of an object publicly. I got a public component but I cant find any ways on the internet on how to disable and enable that component. Here's the ...
Object's user avatar
  • 289
1 vote
2 answers
369 views

Unity: How to work with forms

Today I learned some cool tricks about sizing containers and its children, I mainly using this, because I need to build some forms. But now... It is some preffered way how to handle forms? Or some ...
Zechy's user avatar
  • 67
0 votes
2 answers
1k views

transform.position returning wrong value (UNITY 2D)

I am trying to place the ball on the paddle until a key is pressed, also there is box collider that triggers if the ball falls down. For some reason the transform.position.y of the ball gameObject is ...
Kevin Tony's user avatar
-1 votes
1 answer
423 views

Null reference on gameObject that has been successfully referenced [duplicate]

It's exactly as the title says. I am getting a null reference error even though I have properly referenced the object. I have debugged my code to show that the result is always exactly what I need ...
Kiyo's user avatar
  • 27
0 votes
0 answers
245 views

Can’t find component Unity

so, I want to add a Cloth component. I click on a gameobjects, press “Add Component” in the Inspector search “Cloth” And nothing comes up. From my searches in google, nobody had such a problem ever, ...
John Smith's user avatar
  • 1,245
0 votes
1 answer
237 views

Unity "Text Mesh Pro UGUI" component rewrites my text! Make it stop?

I'm having this terribly annoying problem where my text is being overwritten by Unity. This Happens regardless of whether I am using tags or not. Here is what I want to appear (more or less, I don't ...
hatinacat2000's user avatar
4 votes
1 answer
3k views

Dealing with more complex entities in an ECS architecture

Preamble: I'm working on a level editor for my engine, which uses an ECS architecture. I have around a dozen component types so far, mostly dealing with graphics, like lighting components, model, and ...
Yattabyte's user avatar
  • 1,013
1 vote
1 answer
6k views

Enable/ Disable Line Renderer points

I have a Line Renderer component with 4 points, I would like to disable and enable the last 2 points at a certain time. My question is, how would I in code (C#) enable and disable individual Line ...
John Smith's user avatar
  • 1,245
1 vote
1 answer
9k views

How deep does the GameObject.GetComponentsInChildren() , Go?

So I have a GameObject which my scene will be it's children. I wanted to get the BoxCollider of all the objects and their sub-...
Henjin's user avatar
  • 405
-3 votes
1 answer
205 views

Does Unity support hair?

As we know, Unity has a cloth component, but is there something to simulate human hair?
Crapper's user avatar
3 votes
2 answers
2k views

In Unity, is there a way to Set a new MeshRenderer?

Here is what I want to do in Unity for a given GameObject go = new GameObject(). I want to create a MeshRenderer, change its ...
AndraSol's user avatar
  • 177
3 votes
1 answer
1k views

Check if GameComponent is ready in Unity?

I am trying to create a MessageBox in Unity, but I'm having some troubles in C#.. This is my code (I'll explain my problem later): MsgBox.cs ...
Kiritonito's user avatar
0 votes
1 answer
197 views

How to make my components only contain raw data?

I'm reading that Components in ECS are just only data and have no logic. I'm trying to follow this and I got that working: ...
FrameBuffer's user avatar
1 vote
1 answer
2k views

How to move objects in any direction by swiping with libgdx android game development

first of, I'm new to android game development so I don't know all the classes and dictionaries within android and libgdx. I'm actually following a game development tutorial for the first time (...
DinoByte's user avatar
1 vote
1 answer
1k views

Why does GameComponent have an Initialize() method?

I'm not sure if this exact question has been asked before, but all I could find were questions about how to work with GameComponent, or why something wasn't working. I understand that you overload ...
Kyle Baran's user avatar
4 votes
1 answer
205 views

Odd Behaviour XNA Game Component

Inside of my main class file I am initializing a number of game components which are used to represent game scenes i.e. main menu and game. I am initilizing each component inside of XNAs LoadContent ...
Nexuz's user avatar
  • 125
1 vote
0 answers
87 views

Can I switch off scenery elements on a 3D model?

I am using a 3D asset that has flat scenery elements (3D island with 2D bushes). [1] Having encountered a number of problems with this scenery [2] I want to deactive it (not visible, not collidable, ...
lofidevops's user avatar
1 vote
1 answer
248 views

How can I resolve component types in a way that supports adding new types relatively easily?

I am trying to build an Entity Component System for an interactive application developed using C++ and OpenGL. My question is quite simple. In my GameObject class I have a collection of Components. I ...
John's user avatar
  • 201
1 vote
1 answer
4k views

When to use GameComponents?

I know what it is and I'm using it as a frame counter for example. But when should I use it? Does it make sense to say "I make all the input handling happen in a gamecomponent"? Is it flexible enough ...
t0rb's user avatar
  • 201
1 vote
1 answer
1k views

component Initialization in component-based game architectures

I'm develping a 2d game (in XNA) and i've gone slightly towards a component-based approach, where i have a main game object (container) that holds different components. When implementing the needed ...
spaceOwl's user avatar
  • 899
1 vote
4 answers
1k views

Which is the way to pass parameters in a drawableGameComponent in XNA 4.0?

I have a small demo and I want to create a class that draws messages in screen like fps rate. I am reading a XNA book and they comment about GameComponents. I have created a class that inherits ...
Oscar Foley's user avatar
1 vote
1 answer
564 views

What's the recommended way of doing a HUD for an android game?

Basically the question is in the title. I'm creating a RTS game and I will need buttons like attack move / attack ground, etc. I am not using any engine. When people do games in OpenGL for android (...
jmacedo's user avatar
  • 521
6 votes
1 answer
3k views

Designing generic render/graphics component in C++?

I'm trying to learn more about Component Entity systems. So I decided to write a Tetris clone. I'm using the "style" of component-entity system where the Entity is just a bag of Components, the ...
s73v3r's user avatar
  • 199
1 vote
1 answer
258 views

How to add several GameComponents of the same type?

in order to load 3D-meshes to my project i created a BasicModel class. I made it a DrawableGameComponent so I can override methods like Draw & LoadContent. Plus I have access to the GraphicsDevice ...
チーズパン's user avatar
2 votes
3 answers
539 views

Need some advice on designing components

So after reading about components for a bit I want to make a very simple spaceshooter game that uses components and systems. However, I'm a bit confused on how much scope each component should have. ...
Jason Watson's user avatar
9 votes
4 answers
3k views

What technique should I use to facilitate communication between XNA GameComponents (or between components of any type in a game)?

I'm starting out on my first 'proper' game project, and I've inevitably hit a block trying to decide how game components in XNA should communicate. From previous (Java) GUI programming events, ...
codinghands's user avatar
3 votes
2 answers
4k views

How do I get access to the SpriteBatch service in my Sprite class using XNA?

I have the following Sprite class (leaving out everything that doesn't pertain to my question): ...
Daniel T.'s user avatar
  • 537
19 votes
2 answers
6k views

How are physics or graphics components typically built in a component-oriented system?

I have spent the last 48 hours reading up on Object Component systems, and feel I am ready enough to start implementing it. I got the base Object and Component classes created, but now that I need to ...
Aidan Knight's user avatar
6 votes
3 answers
5k views

When should a bullet texture be loaded in XNA?

I'm making a SpaceWar!-esque game using XNA. I want to limit my ships to 5 active bullets at any time. I have a Bullet DrawableGameComponent and a Ship ...
Bill's user avatar
  • 1,072
25 votes
5 answers
19k views

What are the cons of using DrawableGameComponent for every instance of a game object?

I've read in many places that DrawableGameComponents should be saved for things like "levels" or some kind of managers instead of using them, for example, for characters or tiles (Like this guy says ...
Kenji Kina's user avatar
7 votes
1 answer
2k views

In XNA, should I use the built-in game component classes?

I'm just getting started on an XNA game for Window Phone 7. For my Flash games I have my own framework that I was just going to port from AS3, but I have just found the built-in game component stuff ...
Iain's user avatar
  • 6,518