Questions tagged [gameobject]

A game object is any object in a game that the player can see and/or interact with. The player object, power ups, enemies, platforms, walls, weapons (if collision detection is considered) and projectiles are all game objects.

Filter by
Sorted by
Tagged with
2
votes
2answers
55 views

How to organize GameObjects into logical groups in a Unity Scene?

Obviously there are a Scene hierarchy, but the problem is that the scene hierarchy was not meant for organizing GameObjects because parent GameObjects affect the transformation of their children. For ...
0
votes
0answers
21 views

stop the camera clipping objects

I'm using RTS_camera as it is the player in my scene, how can I stop the camera clipping into buildings?
2
votes
1answer
396 views

How to make a boss control multiple object spawners in Game Maker Studio 2

I'm working on a boss fight for a 2D platformer/shooter game in the vein of the Megaman franchise. I expect part of the fight to include this boss causing large boulders to fall from certain points on ...
3
votes
2answers
42 views

Change Text - Inside A button, inside a Canvas, inside a GameObject: Access all the texts inside of hierchy?

//.... Gameobject tile; int count = 1f; float posX = 0; float posY = 0; ....// GameObject blueTile = (GameObject)Instantiate(Resources.Load("block_blue")); tile = (GameObject)Instantiate(blueTile, ...
0
votes
1answer
34 views

Detect a collision between a CharacterController and a 3D Object?

I am making an XR game, and I am stuck with a part. Does anyone know a function that would detect this? OnCollisionEnter and ...
0
votes
2answers
79 views

How to store a Transform[,] grid in an ArrayList?

I am new to Unity game dev and trying to expand my knowledge of data structs. I'm building a match-3 game, and I currently have a multi-dimensional ArrayList holding transform coordinates on a grid of ...
0
votes
1answer
40 views

Model turning 2d when it's parented

I'm importing arms from blender for my first person controller but when I make the player the Arms' parent it turns 2d. I have no idea why this is happening so if anyone could help it would be very ...
0
votes
2answers
106 views

My GameObject keeps spawning when it shouldn't

I'm trying to instantiate a new gameObject when the current gameObject gets to a select point. The problem comes when the program gets to the second if() statement. It sets the floorsSpawned to 1 and ...
0
votes
1answer
307 views

How can I resize a game object using single drag handle?

Really need your help. I'm trying to create a custom controller for my app to allow users to resize and rotate game objects using a single drag object. I was able to create the code to create the ...
0
votes
1answer
20 views

can't instantiate different objects

I'm trying to instantiate different prefabs at once. But couldn't figure out how. I tried to use Random.Range method but didn't worked for me. It instantiates only one of the prefabs. I want it to ...
1
vote
2answers
396 views

Access a clone of an instantiated object - not all the clones?

I am trying to access the object I instantiate - basically a prefab car instantiates cars (one after one) ..the problem that when try to move one .. they all move together ... what's the best way to ...
1
vote
1answer
112 views

Instantiating GameObjects in Custom Game Engine

So,i'm having a bit of an issue with instantiating my gameobjects into to universe(My Scene object). I can create an empty object from scratch and populate it from there with ease,my problem starts ...
0
votes
1answer
54 views

How would I go about adding a tooltip to a Unity UI Image?

I'm going to try out the community here once more, I haven't had very good look in the past with getting help. I'm iterating through a series of List() and I'm creating a bar graph and a line graph ...
0
votes
0answers
27 views

Unable to wire UI Text object to C# Script

I have created UI text object And then created Text field in behavior class: ...
0
votes
0answers
54 views

Why my capsule collider sometimes stucks in other colliders?

I'm creating a third person game, and sometimes I face a strange bug that I cannot figure out. Indeed the player may remain stuck in static scene objects, and cannot escape until an angle large enough ...
0
votes
0answers
17 views

Get and destroy gameobject component of same type

I want to destroy any graphic component on a gameobject , example is image,raw image, sprite , ect .But i don't have the list of all graphic component so i don't know how to loop through it . The ...
3
votes
5answers
4k views

Unity 4 - Some Rigidbodies Won't Fall Asleep

I'm having this problem in the free edition of Unity 4.1 where rigidbodies aren't falling asleep (and yes, I've tried playing with the sleepVelocity and ...
0
votes
0answers
30 views

What would be the best way to find a Game Object that is closest to another Game Object in unity?

I made a 2d space shooter game awhile ago and I want to go back into it and overhaul some things. I'll provide a link to the game so anyone can play and get a better understanding of what I'm trying ...
0
votes
0answers
29 views

Is there a way to get the actual joystick.Vertical and joystick.Horizontal Value?

What I want to do is Pass a parameter called joystick_tag. (like this: Get3DJoystickPosition(joystick_tag)) Get the current ...
3
votes
2answers
78 views

How to Iterate thru game object and access scripts by name?

I'm using a "toggle visibility" script on many objects in my scene, and in my gameController class I'm storing references to them in an array like this: <...
2
votes
1answer
96 views

Management of objects as targets of other objects

I have started my first game three years ago and learned a lot during that process. Now I would like to rewrite it to incorporate my "lessons learned" or try out new ideas. My game consists of space ...
0
votes
1answer
21 views

List to hold copies of a prefab for later deletion

I'm working on a game in which obstacles are Instantiated randomly 5 to 20 units ahead of the player. When they are instantiated, I want to add them to a list so that when there are too many ...
1
vote
3answers
5k views
0
votes
1answer
26 views

Reduce emission of sphere object with HDRP material

I have a material which I have assigned to be used on a sphere game object which acts as stars. This is what the settings are set to: And this is what the Game View looks like: I have also tried ...
0
votes
1answer
30 views

How to set the color of a game object as of the other?

I am 15 year old Indian student and I am creating my first 2D game in Unity. I have set the color of my player as Random and I have to set the color of my game object as of my player. But the color of ...
0
votes
1answer
89 views

How to differentiate between object types and roles?

I have a base class Object, and depending on how the object must behave on the scene, I have multiple abstract "role" classes, that inherits virtually from ...
0
votes
0answers
36 views

Generating objects in Open Worlds

using Unity I have an open world (infinite) which is proceduraly generated in chunks. In this world I want to proceduraly load objects/trees/grass by raycasting them around the player position and ...
0
votes
1answer
221 views

In Unity, how do I add a MeshFilter to an empty GameObject to generate a procedural model?

My code below is modeled after Unity's documentation. When I put the script into an empty GameObject, the error I get is: MissingComponentException: There is no 'MeshFilter' attached to the "myMesh" ...
7
votes
5answers
25k views

How to store references to scene objects in prefabs?

i am instantiating a few game objects in my scene using prefabs and i would like to attach a script to some of them to do something at a certain time but for that i need to reference to scene objects ...
0
votes
0answers
80 views

C++ OpenGL: Object Components

I've been trying to make a barebones engine/game in VS C++ with OpenGL. So far it's worked well, I've managed to render two green triangles on the screen and can accelerate one using WASD input. ...
0
votes
1answer
43 views

Unity: Unsharp edges

I have a Unity Project and somehow the edges of objects in my Scene (Scene view and game view) look like this: I think I already had that problem once, but in my recent projects, this didnt happen ...
0
votes
2answers
49 views

Updating object's property on Start is visible for a second when game loads

I have a world selection scene in which I have GameObjects representing worlds. The GameObjects have default properties when the ...
0
votes
1answer
47 views

Instantiation of a custom class

I have a custom class named Stars: ...
-1
votes
1answer
58 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 ...
0
votes
2answers
117 views

Querying game objects in real-time

I'm thinking about working on a game where I need to find all the objects matching certain properties. For instances I might need to look up all the objects... Producing gold. Whose level is 5 or ...
1
vote
1answer
51 views

How can I insert a prefab instance programmatically inside the Canvas, in the bottom-left corner of the Canvas?

I am trying to create the Snake game in Unity, based on this video tutorial. I have also viewed this tutorial. I have created the new project with the 3D template and manually added the Canvas. I ...
1
vote
1answer
86 views

How to Make Different Instances of an Object Have Different Sprites

In Game Maker, I am trying to make it so that three instances of an object have three different sprites. Using DnD, what would be the optimal way to do this? If it helps, the three instances are ...
-1
votes
1answer
98 views

C++: passing gameobject as a parameter and then into vector

firstly iam used to java and new to c++ so maybe this will looks a noob's question i will explain this and give a pseudo code and then c++ just so you can understand me i have a player class which ...
9
votes
3answers
555 views

How to have multiple GameObjects sharing pieces of same material?

My question is: There's any way of having GameObjects sharing pieces of same Material, not a clone, but an extension of one? For example, in these case nine game objects sharing just the same material ...
0
votes
1answer
112 views

Dealing damage over multiple frames without damaging the same enemy twice

I am using Physics.Overlap to find which enemies are in my damage range. But dealing damage in only one frame is not what I want. Some attacks should be active for ...
0
votes
2answers
137 views

Why is there a gameObject inside a GameObject

In order to manipulate a game object via script in Unity I need to access the gameObject inside the main GameObject. Why is it ...
0
votes
1answer
89 views

Spawn Array of GameObjects to Array of Transforms

I have a question regarding spawning an array of GameObjects in Unity. What I want to happen is that when a big enemy dies, it will spawn enemies into their respective Transform positions (i.e., Enemy ...
1
vote
1answer
232 views

Storing transformations in game objects. (GLM, C++)

I'm currently writing a game engine from scratch for learning purposes. I just started implementing transformations. I know how they work in general but I'm not sure how to implement them efficiently ...
0
votes
1answer
51 views

How do I make a GameObject carry across only 2 specific scenes?

I have a GameObject in my main menu and help scenes that I want to carry across both scenes but be destroyed on all other scenes. I am having multiple issues with it such as it wont destroy on other ...
0
votes
2answers
391 views

In Unreal Engine 4, how do I get the component's “game object” via C++?

I have an ACharacter instance with a weapons component that inherits from UActorComponentattached to it. I'm currently writing ...
0
votes
1answer
199 views

Unity3D: Move the parent gameobject relative to the child

So, I have X and Y game objects. I have a vector Z = X - Y which is indicated by the green line. Also, I have a ...
0
votes
1answer
59 views

How to remove an element from the scene while keeping it in array?

I combined cube meshes to make a big one. I stored the info of every cube in an array within a list of chunk. Now i want to delete the cubes in the scene to only keep the combined result, but without ...
0
votes
2answers
128 views

How to make extendable Mario warp pipe in Unity?

I want to make a warp pipe from the Mario games in Unity. The key feature of this object will be that I can set the length (height) of its "neck" to any length I require, as long as it is greater than ...
0
votes
3answers
113 views

Count the number of Vulnerable and Invulnerable crops

I have this code that counts how many GameObjects (crops) in the scene GameObject[] crops; and the code to get the health component of each crops ...
0
votes
2answers
291 views

How to reference a GameObject from the Scene Hierarchy in C#?

I am a novice in Unity. I have a Game Object named 'courtsuit'; you can see it in my Scene Hierarchy panel here: I added that object instance to my scene by dragging an OBJ file from my Project ...

1
2 3 4 5