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

Unity:Detecting collision switch while maintaining game functionality

I have created a random generator for a prefab called "Tunnel". Whenever i collide with a tunnel prefab, i wish to keep the game running. If i am no longer colliding with a tunnel i wish the game to stop. The game works fine for the first tunnel,…
user2177334
  • 15
  • 2
  • 7
0
votes
1 answer

Create empty object with transform information in Unity3D

My initial intention was to create transform objects in an array, because all I need are certain points in space, that hold information about the position and rotation. I discovered that this wasn't possible, so I then went to create an array of…
Kalumo
  • 11
  • 1
  • 3
0
votes
1 answer

Particle system ONGui() - Unity3d

I am developing a game in Unity3d and I have some scripts which uses OnGUI() method and they are attached to my GameMenu object. I need to play a particle system on the scene while the GUI scripts are active. When I do that I cant see the particle…
0014
  • 893
  • 4
  • 13
  • 40
0
votes
1 answer

Raycast hit game object in unity

I created a 3d main menu in unity, each button is a cube. I enabled the user to press on the button by raycast hit, the problem is that I want to change the cube color when the raycast is on the cube and convert it back to the original color when…
Elior
  • 3,178
  • 6
  • 37
  • 67
0
votes
2 answers

Untiy | Find can only be called from the main thread

I want to move the gameobject named "Capsule" when i press the button that i made. The json data is sent to server at this moment. I'm just trying to test that the button can control the gameobject. This is the script I've done from now on and the…
홍의숙
  • 297
  • 4
  • 11
  • 28
0
votes
1 answer

unity 3D : not detecting OnTriggerEnter with a prefab

I have a prefab and its moving on Z-axis, want to destroy it when it reaches collider that is a trigger (yes I checked the Is Trigger box on the collider). I have written this code directly off of Unity documentation found…
0
votes
2 answers

Unity: An object reference is required to access non-static member - Ray cast to GameObject

I'm making an RTS style game and i've got an error. I'm trying to send the current selected unit (the object the script is on) to the Playmaker FSM of the object the raycast hit. I realised that you cannot access gameobjects and transforms inside of…
4t0m1c
  • 329
  • 1
  • 7
  • 20
0
votes
1 answer

CreateEmptyPrefab does not keep texture on meshRenderer

I'm creating a prefab dynamically and trying to set a bunch of properties on a child GameObject. One of those properties is a texture, and though the texture does appear as a child of the prefab (in the same way the GameObject and Mesh do), the…
0
votes
1 answer

Bullets shooting the wrong way with AddForce

Im a beginner in unity so right now I'm working in a turn-based game like worms game. But for some reason my attack script only works for the left side units, and not the right side ones. Specifically, the bullets that I instantiate go the wrong way…
user2737948
  • 329
  • 2
  • 10
  • 25
0
votes
2 answers

Changing sprites using Sprite.Create does not take effect?

I'm making minecraft-like 2D game and everything seems like it's okay except changing block texture in one chunk. This is how I try to change sprite: var block = new GameObject("blok", typeof(SpriteRenderer), typeof(BoxCollider2D),…
0
votes
1 answer

GUI text overlapping

Hello below is the code when my character moves and 2 or more objects come into the field of view of raycast, the GUI element overlap the their name. I have tried many options of GUI but not succeeded, please tell me what could be the right…
Anas
  • 25
  • 1
  • 5
0
votes
2 answers

Set active gameobjects in a list

I'm making a menu for an Android 2d app, I have a bunch of UI panels in multiple menu's and when I press the next right or previous left button the script should set the next panel active and deactive the previous panel, I've tried doing this with a…
Dane Gillis
  • 137
  • 1
  • 3
  • 14
0
votes
1 answer

AssetBundle loading model is not showing in mobile

0 I'm loading 3d model from server url and using assetbundle but when i load the model in unityeditor it's working fine and the 3d model of cube is displaying proper. But when i load the model in android mobile the model is not displaying in the…
raj
  • 17
  • 9
0
votes
1 answer

Save prefabs to array

In my game, players shall be able to select units from a menu, which will later be used (placed) in various scenes. For that, I want to save the unit prefabs in a static array through code. I then want to access these prefabs, to display some of…
Tuxedomask
  • 53
  • 2
  • 6
0
votes
0 answers

The array of index value is not starting from 0

I have 2 buttons to load the different texture images and when i press the 1st it loads the 4 images in textures and when i press the 2nd button it loads the 3 images in textures. But the problem is when i press the 1st button it loads the 4 images…
raj
  • 17
  • 9