Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
8 views

“SetSelectedGameobject” only highlights button on second try (Unity 2017.3)

To support the use of a gamepad in the options menu I set SetSelectedGameObject and firstSelectedGameObject (which doesn't seem ...
0
votes
0answers
32 views

Unity gameobject won't rotate properly

In my Unity2D project, I have an abstract class Barrier, which contains a protected abstract property Speed and a virtual ...
1
vote
0answers
26 views

What are the extents of an Axis-Aligned Bounding Box (AABB) in Unity 2D?

In Unity 2D, you can attain values for collider2D.bounds.extents and collider2D.bounds.size. What are the actual "extents" of ...
0
votes
1answer
32 views

How do I move many “static relative to each other” objects around?

I'm currently building an Elevator Bank simulator in Unity3d and I'm stuck on how to reduce the amount of objects it's going to generate when it's done. The simulator will consist of one player (for ...
2
votes
2answers
66 views

I need to keep music playing but still be able to mute it between games, how?

I have a game built in Unity. The game plays music continuously, which can be muted on button press on the scene. This works fine using the below code: ...
0
votes
1answer
20 views

Unable to add button in Unity

I am wanting to add a button to my scene in order to mute/unmute music. I can add the button to my scene, but it's not appearing on the UI. I can't see it anywhere, not on the scene nor the game ...
0
votes
1answer
38 views

How do I prevent repeated interactions between two game objects?

I am making a game where a player will jump into another object called land and everytime the player lands or collides with it, a score will be given, now my problems is that my method has a loophole ...
0
votes
2answers
29 views

How can I access a method on a child elements script in Unity?

I'm using Unity. I have an empty elements called GameElements which I programmatically add child elements to (players can spawn these objects themselves in-game). ...
0
votes
2answers
30 views

After using Unity's Destroy() function, I see the Prefab Clones are now called “New Game Object” is this a problem?

I use a prefab to generate several gameobjects which I then get rid of with the Destroy() function. I noticed the clones, when destroyed are replaced with "New Game Object". Because of the nature of ...
3
votes
1answer
807 views

Unity3d - Do I need to destroy gameobject AND script?

From proper leak protection do I need to delete both of these or will getting rid of one take care of both? Currently I am destroying the script AND the gameobject ...
0
votes
0answers
24 views

Unity each gameobject found twice using FindGameObjectsWithTag

I create 5 gameobject instances: GameObject angryasteroidcloneeast = Instantiate(angryasteroid, pos, angryasteroid.transform.rotation); Triple check that ...
0
votes
1answer
43 views

Are constantly growing (in dimensional size) GameObjects a problem?

It's possible the following is fundamental to Unity, and not a problem? I am using an example of a WheelJoint2D/Car from the Ray Wenderlich tutorials. Note from the pic below, the top level game ...
0
votes
3answers
40 views

Public value null after assigning it from a different script

Hello I am a beginner in Unity and still currently exploring with scripts. So I ran into a problem. In FetchAndAssign.cs Script ...
2
votes
1answer
29 views

How to create a grid of 3d objects without making them actual GameObjects

Very simple question: If I'm going to be generating and placing a lot of 3d objects (in this case cubes), that are not going to be interactive, like no collision, no raycasting intersections etc. ...
0
votes
1answer
28 views

How to dynamically construct a reference to a game object by name

I have game objects tagged MenuOption0, MenuOption1, MenuOption2, etc. I want to keep a currentIndex var, which gets incremented each time the user swipes on the controller. That swipe should ...
0
votes
1answer
53 views

How to store 3d transformation in a game?

I am curious what is the best strategy to save 3d transformation of a model. Here are the few choices I think about: 4x4 matrix 4x3 matrix(skip the bottom row of a 4*4 matrix) Dual quaternions with ...
1
vote
2answers
64 views

What are common methods for organizing game objects?

I'm in the early stages of developing a game in C++. As of currently, I've defined a base GameObject class that is the base class for any interactive item in my map (e.g. enemies, loot, projectiles, ...
0
votes
1answer
65 views

How to arrange child objects in a grid

i have a gameobject that have a group of plane meshes that created randomly as child every one of this planes have a "2f" offset in x axis between every plane what i wanna do is i wanna make the ...
0
votes
0answers
29 views

How do you rotate a Unity gameobject with the device's gyroscope?

I currently have a gameobject placed atop a wedge as in the image below: I want to make the user have to rotate their device to keep the rectangle balanced upon the wedge. Here is the C# code I have ...
0
votes
1answer
35 views

How can I determine when colliders of two gameobjects touch one another?

I stop gameobjects from colliding with one another by having box colliders around the gameobjects with dimensions bigger than the gameobjects. It works fine, but I want that when the gameobjects ...
0
votes
0answers
62 views

Load & display .obj file at runtime using the FastObjImporter

I want to import and display an .obj file at runtime and found a fixed version (click, direct link to pastebin) of the FastObjImporter from the Unity wiki (click). Since my .obj file doesn't include ...
0
votes
0answers
20 views

How to keep count of gameobjects as they are created?

I am creating multiple gameobjects and I need to keep count of these gameobjects as in on number 1 so and so gameobject is generated, then on number 2 other gameobject is created and so on. I don't ...
0
votes
1answer
14 views

GameObject With Background Covers GameObject Without Background

so I have two sprites, a box and an X animation (I'm making Tic-Tac-Toe). So, in the code, when I click on the box, it instantiates the X animation at the right place. The X animation does not have a ...
0
votes
1answer
31 views

Why is my inherited class's transform always null?

I have a class inherited to another class, and I can't get the transform on the inherited class. Here's what i have and trying to do ...
0
votes
1answer
56 views

How to make sure that a GameObject which gets a certain tag first, is allowed to do something first?

I have created a trigger zone to make sure that only one gameobject should pass through the trigger zone at once. Other gameobjects approaching the trigger zone are made to stop just outside the ...
1
vote
3answers
98 views

Is it possible to have two trigger zones around the same GameObject in unity?

I have created a trigger zone to make sure that only only gameobject passes through it at a time. The moment the gameobject1 entered the trigger zone, it is given a particular tag but I am not how to ...
0
votes
2answers
115 views

When there are multiple objects of the same type, how do I know which one I am colliding with?

I'm working on a platformer game using Gamemaker Studio 2. , and currently I'm dealing with implementing platforms: (Platforms are able to pass through from the bottom, but remains solid when landing ...
1
vote
1answer
36 views

GameMaker Studio 2 - How to place object back beyond X coordinate for looping (warp)?

I'm making a side-scrolling shooter where I want an object to move from right to left (towards negative X), then, when it's passed out on the left side, jump back to beyond the window width (right ...
0
votes
2answers
54 views

How to make UI Button to rotate an gameobject?

I'm trying to make a button to make a gameobject rotate and stay rotating in its own axis (Y) but I cannot make it work... As far as I know it's very simple: Create an empty gameobject (or whatever ...
0
votes
1answer
33 views

How to automatically destroy a gameobject after a method or block of code

In Unity I frequently find myself doing this in C#: ...
0
votes
0answers
30 views

Restore scene by adding stored objects

My game has a bunch of GameObjects that I created with code at runtime and that I "store" in an array in a static class. When I unload the scene and load it again, these objects are gone (of course). ...
0
votes
1answer
158 views

Can a Component.gameObject be null in Unity?

Can a Component.gameObject be null in Unity? If it can what can cause it to be null? The context for the question is a ...
0
votes
1answer
32 views

Unity use image to load prefabs along a line

Say I have an image of PNG or a bitmap with a line zigzagging through it. I have done quite a bit of research in the answer still eludes me to how to use an image in unity and have it generate ...
2
votes
1answer
392 views

Is there a way to make a game object invisible to only certain players?

I have found a few posts and blogs here and there. But all of the solutions they provide seem to be global. Is there a way for let's say a multiplayer scenario where maybe an enemy has a cloaking ...
0
votes
2answers
388 views

Unity, rb.MovePosition and transform.Rotate at the same time

I can't figure out why my object can't move and turn at the same time. ...
0
votes
1answer
291 views

UnityException: Transform child out of bounds (only in built APK)

In the Unity Editor, this code helps me to get the Fog GameObject: ...
0
votes
1answer
53 views

Using StartCoroutine() and WaitForSeconds()

I am trying to perform two operations. First I want to increase the size of a GameObject and then delay for 0.1s before returning it back to its original size. However, when I try using StartCoroutine(...
0
votes
1answer
21 views

Attach the UIButton to Component Via Script (C# Unity)

I want to attach the UI to the MC_Streaming Option Script via Code . What i wanted here is that this live_onOff will go to the Livestream(MC_Streaming Option) ...
0
votes
1answer
28 views

Calling Functions from Other Scripts

Say I have three different gameObjevcts, each representing rock, paper or scissors. These objects all have a Player script ...
0
votes
1answer
72 views
0
votes
0answers
294 views

Right Click Context Menu Using Attributes in Unity3D

I'm trying to create a right click context menu as you would see on Windows or OSX for use in run-time in Unity with C#.The menu needs to be able to take an object that is passed into a script on it ...
1
vote
1answer
23 views

How does Actionscript choose which order to run objects' code in?

I can only assume that Flash runs code in the order that objects were created - so newer objects are run later. Is this true? Is there any way, other than deleting and recreating objects, that I can ...
0
votes
2answers
100 views

Is it more efficient to add scripts to each GameObject or to a single parent object?

Does a C# script added to a parent object work more efficiently and effectively (in terms of both memory and performance) on all objects, in my case lighting, or adding script components to each ...
0
votes
1answer
129 views

Trying to get an object to move in the mouse direction XNA C#

Right, so in my Player class where I call the object I got an if statement which gets the coordinates for the mouse ...
0
votes
1answer
78 views

Difference between Object.Destroy() and GameObject.Destroy() in Unity

What is the difference between using Object.Destroy() and GameObject.Destroy() in Unity? I found the following info about that: ...
2
votes
1answer
144 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 ...
0
votes
0answers
446 views

Recursive serialization error?

I'm getting a series of five errors every time I try to load and instantiate an object from resources: ...
0
votes
2answers
95 views

Synchronizing “token” between players(multiplayer) [duplicate]

I am implementing the multiplayer(client-server architecture) of a game, and I came to doubt about entities common to players. I understand how to share information such as the position of the ...
0
votes
0answers
43 views

Quickest way to make a destructable object in UE4 using blueprints?

I'm a novice at games development. I spent two years learning bit and pieces of the industry at college. But during this time I never properly made a game, just learned the foundational skills of them....
0
votes
1answer
2k views

ScriptableObject referencing a gameobject in scene

What I'm using for the scriptableobjects that requires a reference of a gameobject in scene is for scheduling events like for moving. Meaning a scriptableobjects should have a gameobject or waypoint ...