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
1 answer

How to bring Unity3d car gameobject to initial position without Destroying and Instantiating it again?

I made one 2 wheeled car with one caster wheel in front in Unity3d. After moving the car for some task, I want to bring it back to the initial position after pressing "STOP" button through Unity3d. I did the following for doing so.…
Niks
  • 57
  • 2
  • 8
0
votes
1 answer

Scaling a wheeled car GameObject in Unity3d with Wheels as Configurable Joint

In my application I want to resize my Car during Runtime. I used the following command to do that. myCar.transform.localScale = new Vector(x,y,z); before executing the above command I am enabling isKinematic property in rigid bodies which are…
Niks
  • 57
  • 2
  • 8
0
votes
2 answers

Unity approach an object in spiral motion

In Unity I can handle circular motion around an object with a simple transform.RotateAround(GameObject.Find("CubeTest").transform.position, Vector3.up, 20000*Time.deltaTime); However, I want the object traveling in circular motion to approach this…
Stupid.Fat.Cat
  • 10,755
  • 23
  • 83
  • 144
0
votes
1 answer

Unity3D: Moving GameObjects with mouse and check contains

How can I move an object (a gameobject fill color using GUITexture for example) by mouse click/touch to grid and check contains fill color for each tile? If use Camera.main.ScreenToWorldPoint then can't check contains. Current my code to check…
691138
  • 97
  • 3
  • 8
0
votes
4 answers

How to put gameObjects into the list?

I have gameObjects and I need to put them to the list, something like that: List unityGameObjects = new List();
Timy Ash
  • 107
  • 1
  • 1
  • 11
-1
votes
1 answer

Calling an Int from another Script that lives on a Prefab

I'm super new to c# and I'm making a 3D game in Unity. I have an int that I want to call upon in another script, but the original script that the int is in, lives on a prefab that isn't on my terrain. Here is my first code that lives on the…
-1
votes
3 answers

GameObject is not getting activated after build (Windows, Mac, Linux), but gets activated and works as expected in the editor - Unity

I tried all the recommended steps and potential solutions suggested over the forums. However, this problem still persists. Its been 5 days and I am still trying to find why it happens only in build export and not in unity editor. [Edit (1st Dec…
-1
votes
1 answer

I find a way to use less "GameObject.find" but I´ve never see somebody do it like that, am I wrong?

I needed to find a better way to find my Game Objects without using GameObject.Find because I have this line more than 30 time is one script, so I created this line on my script: public List gameObjectList = new…
Sevlac
  • 39
  • 8
-1
votes
1 answer

Roll an object towards the player like a ball

I am trying to make a game object which is basically a ball. For now, I can bring the ball towards the player with the FollowPlayer Script, but cannot rotate towards the player like a ball. Requesting assistance, The code is as of the…
-1
votes
2 answers

Destroy game objects one at a time, with time interval

I have created a procedurally generated 'tiled floor' in unity3d, using a block prefab asset and script as follows: using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class Wall : MonoBehaviour { …
-1
votes
1 answer

Unity changing from game object to ui Image

In unity I am fetching a UI image through GameObject.Find() However when I try to change the value of another image component to the result of the game object find I get the error: Cannot implicitly convert type 'UnityEngine.GameObject' to…
-1
votes
1 answer

Can't add generic script to GameObject Unity

My script is called Grid and when i try and drag it into a game object it says "cant add script as script class can't be found. Make sure that there are no compile errors and that the file name and class name match." what should i do, because the…
-1
votes
1 answer

transform.Rotate an empty game object in unity

I am trying to make an empty game object which is the path generator rotate when placing a tile left or right. But somehow it does not rotate the object. Plz help! using System.Collections; using System.Collections.Generic; using…
-1
votes
1 answer

How to use a string inside GetComponent to connect others files in Unity?

I have a string list of characters e I'm trying to get information from another exclusive .cs file to the main .cs file. How to change this string character_selected; if (character_selected == "Jin") { …
-1
votes
2 answers

Conserving instantiated game objects between scenes

I have a case of 2 scenes : A - is a loadscreen where i proposed a number of buttons corresponding to different levels of the game B - are a certain level of the game A is generating the buttons by the code: for (int i = 0; i < LevelNumber.nbLevels;…
ASSADOUR
  • 27
  • 4