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.

learn more… | top users | synonyms

0
votes
1answer
19 views

Unity 5 Animator will not disable

I am making a small FPS in unity 5. I made a cursor animation that I want to play only for a brief moment. I tried to do this using some code: using System.Collections; using System.Collections....
0
votes
1answer
25 views

Raycast2D ray not follow object

I have some Raycast2D problem. I want raycast follow the object like this: But when I drag object somewhere the ray looklike this : Here is my code where is my fault. Please help :( using ...
0
votes
2answers
28 views

Unity: How to keep the music muted on reloading the scene?

i am giving the user a UI button to mute and unmute the ingame sounds but the problem is when i mute the sounds and then when the game ends and the game scene reloads the sounds come back up which is ...
0
votes
1answer
25 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-objects and their sub-objects's sub-objects and ... . So can I do that ...
2
votes
1answer
53 views

Different objects interacting based on type

Many many thanks to anyone who chooses to take the time to read through this all and offer any advice. I'm writing a game in which multiple different kinds of Objects move around a grid-based board ...
1
vote
3answers
75 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
17 views

OpenGL C++ - Only one object appearing in scene, Parent/Child positioning problem

I have a raytracer which I'm trying to build a SphereFlake in, but I'm having trouble with the objects in the scene. When I create a sphere it creates perfectly, but when I try to create another ...
0
votes
2answers
28 views

How to make Lists (and Arrays) in Unity only take GameObjects of a certain “type”

If I were coding in generic C# I can create a list that only stores a certain type of object. If I accidentally try to add anything other than that type to the list I will be promptly told and can fix ...
-3
votes
1answer
26 views

Changing an objects on through C# script in Unity

I am trying to export my Unity project to Android Studio so that I can create some Android buttons that "controls" the Unity app's behavior. I know what I have to do in order to let it access through ...
1
vote
0answers
25 views

Make a decal a physical object?

Is there a way in the UE4 to make a decal such as a blood decal and give it a physical object? I want to do it so that I can add a sound affect when the player walks on the physical object, a box ...
1
vote
1answer
204 views

On Click Add Listener not working on Game Object

I have this code attached to a 3D cylinder game object. I plan to use it as an arrow and rotate it when clicked and dragged. I had no idea what do as I am a beginner so I started with adding an ...
0
votes
0answers
73 views

How can I make an interactable physics-based ragdoll in Gamemaker: Studio?

I want to be able to make an interactable ragdoll in Gamemaker than can be dragged with the mouse, have detachable limbs if too much force is exerted on the ragdoll, and to be able to collide with ...
1
vote
0answers
39 views

Finding the Dimension of OBJ objects

I am having a Three OBJ file , Cone , Sphere and Cube. How can i find the dimension of these objects , so that i can use it in my collision detection class. i.e How can i find Radius , Length of Cube ...
0
votes
1answer
32 views

What happens with associated animation clips when I copy a gameobject in Unity?

I have a gameObjectOne that has two animation clips: move into the screen and move out of the screen. This gameObjectOne has an animator that checks when each clip has to be played. Now I duplicated ...
0
votes
0answers
32 views

Which GameObject should I put the animator on?

I have a GameObject. One of its children is an empty GameObject, whose children are the body parts which need to be animated. Character (root) --->Body --->--->Body Parts Should I put the ...
-1
votes
2answers
59 views

How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d

I can't get my gameobject to pause or unpause in the scene in Unity3d. I need the game to pause for a couple of seconds maybe longer than unpause by itself. Here is my script : using ...
3
votes
2answers
159 views

How to automatically delete an object in Unity?

I am new to unity and the other day I was wondering that it would be useful if I could instantiate some objects in my game scene and, as they get instantiated, make it so that they get automatically ...
1
vote
1answer
48 views

What is this tracking circle called as?

I don't know what the circle in the image below used for changing directions and movements of a character is called. Can anyone provide me anything related to it? I want to include it in my game.
-1
votes
1answer
43 views

How do I use Couroutines for spawning and spawn certain amount of enemy AI in the scene?

I have made a spawn function for spawning enemy AIs, and it didn't work well in my scene. I have the enemy AIs spawning in the update function, and it initially works fine, but it's spawning too many ...
-3
votes
1answer
67 views

gameObject and col.gameObject both get destroyed

I want a square[0] to be destroyed by triangles(tag = 2) and circles(tag = 3) when the square comes into contact with them. Also I want square[0] to destroy square(tag = 1) and not be destroyed ...
0
votes
1answer
88 views

Unity2D - How to destroy my Instantiate particle system

I'm having trouble trying to destroy my Instantiated particle system, I can only destroy my gameobject using UnityEngine; using System.Collections; public class meteor_destruction : MonoBehaviour { ...
2
votes
0answers
73 views

How to disable and enable a randomly generated prefab in an endless runner 3d

Hi all I have been experimenting the endless runner game for some time and needed to optimize it. I read some articles about optimizing my game and it says that once you instantiate the prefabs in the ...
0
votes
2answers
124 views

Prefab Instantiates into scene, but when I store a reference to the instance it's null

I am instantiating and parenting two objects - the first is a Unity primitive and the second is a prefab cube (literally nothing but a cube made into a prefab). The direct instantiation of the ...
0
votes
1answer
277 views

In GameMaker how to check if instance is a given object?

Let's say, I have three objects: obj_square, obj_circle and obj_triangle. Instances of all three types of objects exists in the room and call the same script: scr_test. Inside of this script, how ...
1
vote
4answers
137 views

How to find nearest gameobject on one side

Here is an example: The left enemy robot is closer than the right enemy robot, but I want the character to attack the robot that is closest to him on his right side. I can't use Physic.SphereCast or ...
0
votes
2answers
175 views

snap an object to another object?

so I have some walls which are cubes stretched along a direction.and I have some windows and doors that are suppose to snap to a wall and don't let go until the desired location is out of the snapping ...
0
votes
1answer
60 views

How to get which gameobject the mouse is over in Unity?

So I'm working on a simple drag-n-drop based trading card game for my own amusement. There is a card inspector included. What I want to achieve is to change values in the inspector (which has its ...
4
votes
1answer
277 views

Blender assets management and workflow for Unity project

I'm trying to decide how to manage my 3D assets, and even how I should construct a world for my game. I should maybe explain, my game is basically a single explorable world set in a school. It's ...
0
votes
1answer
77 views

Simplifying Object Factory

I'm making a game for Android using Libgdx with Android Studio in Java. In my game, I have a class called ObjectFactory which has a method createGameObject(int objectType) which receives an integer ...
0
votes
2answers
45 views

Roatating a Game Object downward

In my game I have a rocket which is traveling horizontally across the screen. What I am trying to do is when the player runs out of fuel, the rockets engine stops (already coded) and then the rocket ...
0
votes
1answer
174 views

Unity - Hide GameObject that is behind UI

I have the following example: How can I prevent the part of the sprite that is highlighted in red and is behind the UI from being displayed on the camera, but having the background image still ...
0
votes
0answers
21 views

MeshRenderer.sharedMaterial does not change twice

Hi I was changing material from an object and using this code that's working well: MeshRenderer renderer = tile.GetComponent<MeshRenderer>(); renderer.sharedMaterial = Resources.Load<...
0
votes
2answers
69 views

How to get obstacles to spawn randomly in x position in an infinite runner? 2D

I'm trying to make two obstacles that are different sized to come in a random order in one straight line where the player is going. Doesn't have to be with object pooling. It seems that the ...
3
votes
2answers
183 views

How do I find the location of a GameObject in C#

I'm making an elevator script. Essentially I'm wanting to find the difference between two empty objects so that I can move the elevator between them. To be able to do this, I need to be able to get ...
0
votes
1answer
305 views

Collision between UI element and GameObject

When I first started to develop in Unity I followed the Unity Tutorial for the Space Shooter 2D game and used the knowledge from that to create something myself. Looking at it now it may not have been ...
0
votes
1answer
103 views

Unity: Assign GameObject to Class that hasn't been yet instantiated

I'm creating a game where I have an Entity class that contains basic entity info (pos, health,..) and some functions. Enemies and Player later on inherit from this class. Public class Entity { ...
4
votes
1answer
305 views

Does distant and large objects use up a lot CPU usage?

Okay I'm new to Unity, and I'm making a space sim pc game. You know, space is huge, light years of distance between stars. Even if I set 1 AU (150,000,000 KM) as 1 unit, 1 light year will be 63,000 ...
5
votes
3answers
277 views

How to handle GameObjects that have been destroyed but are still held by others?

I'm developing my own game engine in C++ as a learning exercise. I have employed a fairly standard method of handling destroyed GameObjects: Mark them as destroyed Have the scene delete destroyed ...
3
votes
1answer
94 views

Performance differences: one empty GameObject with multiple child objects vs. single GameObject formed by pre-merging the former child objects

Imagine a robot game where robots are made of pre-built blocks. Therefore, each block is a separate GameObject, with one mesh each. I am trying to understand the conceptual differences behind the ...
2
votes
3answers
391 views

Game Object is Instantiating on same position

I am working on a small project . But now I have come across a problem . The problem is the prefab is instantiating on the same position . I want to instantiate a box end to end . The basic set up is ...
0
votes
3answers
856 views

How to check if a game object is inside another gameobject

My idea is that there is a plane which is more of a border at top of the screen and if a game object has no more space to fall and it collides with something while it is in that border, the game ends. ...
1
vote
1answer
81 views

Method causes OutOfMemory error

If a GameObject in my game has a special ability it triggers it, but I want all the special GameObjects that this GameObject affects to also trigger their abilities, for example if a bomb hits some ...
4
votes
1answer
539 views

Can instantiated objects have different material/texture?

While I have some experience with simple 2D games, I am new to more process-demanding 3D games. One basic question that has been concerning me recently and for which I am having difficulties to find a ...
1
vote
1answer
502 views

Duplicate a Prefab as a separate asset in Unity 5.2 [duplicate]

I have a Asset which is a collectable object [Pickup] and I currently have eight in my scene, I'd like to duplicate this asset and use it to harm the player [Bad Pickup]. I decided to duplicate the ...
2
votes
1answer
3k views

best way to destroy an gameobject in unity

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the ...
1
vote
1answer
53 views

Help with open and close UI Menu on background mouse click

I am trying to make a point and click game in unity 5.2.2. My problem is that I need to have a UI menu to open, when the player clicks with the left mouse button on the background sprite, and it ...
3
votes
1answer
70 views

Assigning Objects when duplicated in the editor?

I'm wondering if there is a way to have an Object when duplicated in the editor assign a GameObject variable to the newly duplicated version of itself. Is there an option in Unity or do I have to code ...
1
vote
3answers
2k views

Set Parent to Instantiated Objects in Unity

i am having problem in attaching parent to the instantiated objects. I have attached the code below. please tell me where i am doing wrong. Thank you. public GameObject brick; public Transform ...
0
votes
1answer
835 views

Unity - SetActive() on GameObject dont works on child's objects

I have the following line of code: GameObject.Find("_obstacles").SetActive(false); It serves to leave an inactive object, but the children of this object are not getting with the same status. My ...
0
votes
2answers
323 views

Create a custom shape from a basic shape

Is it possible to create a custom shape by modifying one of the regular 3D objects in Unity3D 5.1? For an example: Make a cone from cylinder.