Questions tagged [gameobject]

GameObject is a key component of the Unity3D engine. It is often associated with Unity3D questions.

GameObject is a key component of the Unity3D engine. It is often used in the engine when developing games and apps. It can be added to a Unity scene to represent and control many game elements such as UI, audio, effects, lighting and various objects. The GameObject can have multiple components added to it, including a script to control its behavior and attributes.

708 questions
0
votes
2 answers

How do I import a C# monobehavior script during runtime and add it to a component?

I am a bit of a newbie in Unity3D and I have made a script that generates a new C# script (on void Start() for now). this C# script has to be added to a gameObject after it has been made. I tried to find a way how to import this script during…
0
votes
1 answer

How do you raycast from an object ignoring only that object (Unity3d)?

How can I raycast from a gameobject, while ignoring ONLY that gameobject (in Unity)? I am creating a script that detects which side of the gameObject is collided with. I am using a raycasting script that I created to achieve this. I thoroughly…
0
votes
1 answer

how to make gameobject jump forward?

hi i'm really new to this and would like some help, i would like to know how i can make my game object jump forward (the longer you hold the further it'll jump), i have a rigid body on my game object already in case that helps. public class…
Ashraf Rahman
  • 65
  • 1
  • 2
  • 11
0
votes
1 answer

enable only 1 button in a list?(unity3D)

I have a code which spawns a button(gameobject) with presets everytime I press save. This button is then saved into a List of gameobjects which I then use to select or deselect them. I tried to make it so that only 1 button in the list can be…
xalvin
  • 113
  • 1
  • 13
0
votes
2 answers

Rotating a unity configurable joint to match another game object (copycat)

I'm trying to drive a configurable joint to the same rotation as another game object. Basically I'm trying to get one marionette to shadow another. Im using the following code: public GameObject master; public GameObject slave; void Update (){ …
Chris Headleand
  • 6,003
  • 16
  • 51
  • 69
0
votes
1 answer

How does velocity works?

hey guys i've something here to ask about how does really the velocity on unity works ??? i've been working on a project recently, i want to create the bouncing ball games, so whenever the ball hit the collider, it will be bounced depends on the…
0
votes
1 answer

How do I stop the rotation of my gameobject when it reaches a certain point on its y-axis?

I'm currently working on a simple baseball game. What I'm trying to do is have the player be able to swing the bat backwards to "charge up" power, so to speak, and then when a button is released he will swing the bat forward at a speed equal to the…
user4507007
0
votes
4 answers

Enabling Game objects

So I've been trying to access game objects in my scene (which are disabled), to enable them. But I'm getting an error: "Object reference not set to an instance of an object" private List characters = new List(); private…
Dannika Rodriguez
  • 131
  • 2
  • 5
  • 11
0
votes
1 answer

Rookie needs a pointer as to how to get my script for rotation a gameobject to work

I've watched a lot of tutorials and i finally finished this code. I got it to rotate around its pivot point just fine but when i try to check for the gameobjects location on the Z axis to give it different commands according to its location it get…
user4195299
0
votes
1 answer

How to add to scene own gameobject on unity

I create my own cube. I use below code to do it void Start () { MeshFilter meshFilter = gameObject.GetComponent(); Mesh mesh = new Mesh (); meshFilter.mesh = mesh; mesh.vertices = new Vector3[]{ // face 1 (xy…
zakjma
  • 2,030
  • 12
  • 40
  • 81
0
votes
1 answer

My pivot point does not follow my gameobject

So im making this Unity game where i have a gameobject that im moving and rotation during the game, the thing is the pivot point doesnt stick to the object. It rotates just fine on the spot when the game begins but when it has been moved the the…
user4195299
0
votes
0 answers

Only the last gameobject is renamed after the loop?

I save all my gameobject in a .txt file. When I try to load my map with the textfile, everything works as intended, except for the gameobject.name. All the objects are placed at the right position and with the good tag. Here a part of the code. …
0
votes
2 answers

Unity - move 3d object in an AR scene

I have an AR scene that has one AR camera, an image target and 3d object below as. I create an .cs file and attach to ARCamera. I want to move AR object to mouse click position. I tried many codes for this. But I couldn't success it. I know that…
zakjma
  • 2,030
  • 12
  • 40
  • 81
0
votes
1 answer

Gameobject's position is different between unity and iPhone (5)

I'm making a simple 2D game in Unity. The gameobject's position is different from Unity editor to my iPhone. For example, if I want to place a gameobject in the center, then I need to place it a little further up before it is in the center on my…
Loc Dai Le
  • 1,661
  • 4
  • 35
  • 70
0
votes
2 answers

Find GameObjects with keyword Unity

How can I find GameObjects with a keyword in Unity ? Actually, I have a lot of GameObject named like that : Concrete Floor [289483] Concrete Floor [289487] Wall part [293291] Part [321043] ... I already made functions to get the ID of an object…
Dean
  • 1,512
  • 13
  • 28