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

Unity3d how to have a "text label" follow a game object

In my world I have a GameObject, lets say a race car. Above the race car I want a white box with a text label that says the driver's name (let's say "Fred"). This label will follow the race car as it moves. How can I create this "white box with a…
vikingsteve
  • 38,481
  • 23
  • 112
  • 156
-1
votes
1 answer

Unity | How to Copy the Values of a GameObject instead of it's address?

For example: List = {a,b} private List FunctionName(List List) { List ListClone = List; ListClone.RemoveAt(1); return List; } output: a Another example: GameObject a = GameObject…
Hana
  • 1
  • 3
-1
votes
1 answer

can i move a gameObject based on just its name?

Im using a raycast, putting its RaycastHit into a variable called raycastHit, using that to get the raycastHit.transform.name, could i then use the information from the name of the gameObject to move its position? Or if not, could i get the…
-1
votes
1 answer

Unity 3D CS0246 Issue

Good day/night! I've been coding in Unity for a few weeks and now I'm playing around with the video player. I'm trying to recreate a TV in Unity so I decided to make class that allows me to create an array of video clips. I finished the class and…
-1
votes
1 answer

How to make a 2d Sprite 3d in Unity

I'm developing a maze game in Unity and I'm using png files as mazes. But I want to make this game 3d. How can I add depth to my 2d sprites?
-1
votes
2 answers

How to refer an object of himself with out saying his name in C#

I have several objects which I need to calculate distance form the main point(main) and increase distence betwen main and each object surrounding it, by taken chaos value. But I don't want to put a different script to each one. I want same script…
-1
votes
1 answer

Child gameObject doesn't move with the parent gameObject

So, right now I'm working on a Unity game where if you click on an item, it will become the child of the click object. The click object is also the child of the player and moves with the player, but the object that gets clicked (making it the child…
-1
votes
1 answer

Parameter disappear in PlayMode (Unity)

I'm a noob at this. There is a problem that I could not solve alone, and I want you to help me, it turns out that every time I enter the unity playmode, the parameters of a script disappear. I don't know if it's because of my script or it's…
-1
votes
1 answer

C# Unity cannot implicity convert type float to int

I'm trying to animate the color of gameObjects that are referenced in array. like this public GameObject[] laneMat; void Update() { StartCoroutine(CountDownMat(laneMat, .3f)); } IEnumerator CountDownMat(GameObject[] laneMat, float…
Ashraf
  • 9
  • 2
-1
votes
1 answer

AudioSource attached button doesnt work in another scene

public AudioSource menumusic; public Button SoundButton; public Sprite Soundoff; public Sprite SoundOn; bool isClicked = true; private void Awake() { DontDestroyOnLoad(this.gameObject); SoundButton.image.sprite = SoundOn; } // Start is…
-1
votes
1 answer

Convert GameObject into the List of Objects made and iterate through

I trust that there are amazing people here that can solve this problem I have a List of GameObjects that have been made in my first script; public List _recordinglist = new List(); Then a button creates a clone and adds to…
-1
votes
1 answer

Unity3D How to copy object to paste at same position?

I want to copy object and paste at same position by using Ctrl+c Barn1_Door_A at the center of map like this image. when I paste by Ctrl+v the object is out of map like this image. The component value of object is same value but why it paste out…
user58519
  • 579
  • 1
  • 4
  • 19
-1
votes
1 answer

Display 10 separate Meshes one by one with looping behavior to create "Animation" for empty GameObject?

I have 10 meshes that are each basically freeze-"frames" of an animation of a whale swimming. If I were to loop through displaying these meshes then it would create a pseudo-animation, which is what I want. How can this be achieved? Currently I have…
Neo
  • 397
  • 1
  • 4
  • 15
-1
votes
2 answers

How to find UI in code c# (button, Panel etc)

in an empty game object i have a selection Manger script. I'm having some difficulties with finding a panel (called: OpenSelection) I created in Canvas. I would like to find the panel where ever it is in the hierarchy and set enabled to true. But…
Tubestorm
  • 1
  • 4
-1
votes
1 answer

How do I make GameObjects use physics to interact with each other using Vuforia?

I'm using Vuforia for an AR school project and am trying to make a Roll a Ball game. However, the ball keeps falling through the ground despite the fact that both the ground and the ball have colliders. How can I the ball interact with the ground?