Quantcast
Channel: Questions in topic: "gameobject.tag"
Browsing latest articles
Browse All 95 View Live

Array elements change Gameobject.tag

Hi I have an array of materials which I can assign in the inspector. I was wondering is there a way to have each element of the built in array change the tag of the gameobject its attached to. This...

View Article



Nothing Happens at OnTriggerEnter ?

I've got a problem about OnTriggerEnter; #pragma strict static var health : int = 100; var bullet : GameObject; var explosion : GameObject; function Start () { bullet =...

View Article

CompareTag - NullReferenceException

Collider2D Obj = Physics2D.OverlapCircle(transform.position, 0.05F); if(Obj.CompareTag("SomeTag")) { isActive = true; } NullReferenceException: Object reference not set to an instance of an object....

View Article

Null reference error can u help me to fix it ....!

hello all i am bit new to scripting in unity. im having a small issue, i want to specific effect when i hit a specific gameobject with a tag. from my code i want to shift from 1st player to second when...

View Article

Help with string to gameObject.name

I try this: void OnCollisionEnter(Collision col) void OnCollisionEnter(Collision col) { situationjump = (""+gameObject.name ""+col.gameObject.name); } But I get an error Error 3 Only assignment, call,...

View Article


Need help finding the closet player to an enemy

Hi, my game can have upto 4 players in it, and I am trying to work out how to determine which player is closest to an enemy, but I cannot seem to make the following script work. I was trying to search...

View Article

"GameObject.FindWithTag" Working with one scene but not another

Hi guys, I feel something strange is happening in one of my projects, I have this code bellow that works on one scene but not another, the one it doesn't work in is my main scene (and yes I have both...

View Article

Activate/deactivate all GameObjects with same tag c#

I'm trying to create a script which would automatically activate and reactivate all GameObjects with the tag 'Flare' on them. 'flareOnTime' is for how long it is active and 'flareOffTime' is for how...

View Article


How could I use a GameObject array to check the associated tags and toggle...

At the moment I'm trying to use an array to check each element's tag and change that object's Box Collider 2D state for each one I want. At the moment the size of the array is 7 where each element has...

View Article


Collision Detection - Strange issues! Working when it shouldnt, not working...

Good Morning Guys and Girls. Having some really weird things happening with a simple 2D box collider set to trigger. I have an NPC (Set up with box collider and 2D rigidbody) walking into a box...

View Article

Problems with Physics.Raycast

I’m making a small game that mainly just involves picking up and throwing things. To do so, I’m trying to create a Raycast on the player, so that when he gets close enough to something, it’ll show that...

View Article

How to check if two objects have same tag?

Hello, I made two objects, with same tag. And I need to check if these two objects have a same tag. How can I get current object's tag? I managed to get second object's tag but not firsts.. Please...

View Article

How to GameObject.FindGameObjectsWithTag within children of a specific...

I want to get a collection (List or GameObject[]... whatever I can iterate through) of the children inside a specific GameObject with a Tag assigned to them. But I'm only able to run...

View Article


Checking if Player object is out of bounds

Hello, I have written a javascript code for checking the player if they have fell out of bounds. This is a 3D platformer that I am tring to make. I am recieving errors and can not run the game with...

View Article

using gameobject.find('key') but i want to make it with a tag

so i i am creating a game where you need to find keys and pick them up. although i will need to assign a tag or make many different scripts for each key carryingBlue = true;...

View Article


Assigning a GameObject as Player with a button

So I'm setting up a basic character creation screen and there are two models on the screen. I want to set up that when you press the button under the model, it will give it the Player tag and add the...

View Article

Anyone experiencing problem with gameObject.tag?

On my "OnTriggerEnter(Collider col)" I am checking col.gameObject.tag == "someTag"; It works well on Android/Editor mode, but not iOS/StandAloneWin. I logged the col.gameObject.tag on screen using...

View Article


OnCollisionEnter doesn't work !

Hello ! I searched on Google but I didn't find my problem's solution. I'm creating a game, I've got a sphere, and that sphere (controlled by a joystick because it's a mobile game) has to move on a road...

View Article

My Tags are getting changed, when its loaded from Asset Bundle.

I have created an asset bundle from several scenes. After downloading and loading the scenes, the tags for the game objects are either becoming as Undefined or the tags for the game object are getting...

View Article

GameObject is already being activated or deactivated

Hi all, I´m having a little problem with my current development process.. When my player dies, the gameObject is deactivated. So far so good. In my game I have moving platforms with a parenting code...

View Article

how to activate countdown on first Gameobject with tag it being shoot

Hi i wanna start a countdown timer when it have hit my first gameobject, but nomatter what i try i cant get it too work my code look like this using System.Collections; using...

View Article


Script working in Edit, not working in Build and Run,Script Working in...

I have two issues with my script, hoping to get some direction where i'm going wrong. Issue 1) OnTriggerEnter2D() I execute an if statement checking if my collider.name is equal to an item name and if...

View Article


Script working in Editor, not working when Build and Run

I have two issues with my script, hoping to get some direction where i'm going wrong. Issue 1) OnTriggerEnter2D() I execute an if statement checking if my collider.name is equal to an item name and if...

View Article

Trying to make the enemy fire

Im trying to get my enemy to fire fireballs. I used ontriggerenter and a trigger box collider and it works but i need it to continue firing while the play is in the trigger. But when I sued...

View Article

Is "GameObject.FindAllGameObjectsWithTag" related to the hierachy?

So I need to do similar things to lots of game objects. I have positioned them in the hierarchy in the order i want them to be found with "GameObject.FindAllGameObjectsWithTag". They just appear to be...

View Article


2D Rotation to target?

Hey guys, hopefully, you can help me find an answer to what I'm doing wrong. I'm trying to get this turret to automatically reset to new targets and transform its rotation to a new target each time one...

View Article

Organised UI List of multiple different Gameobjects by tag

Hi Everyone   I currently have a UI system using text mesh pro that tracks the amount of multiple different gameobjects by tag in a scene. However the tracked objects are always displayed in the UI...

View Article

How to Respawn an gameObject when it touch another gameObject

I need some help on the game, and I can't find any useful script on YouTube or in any Website, I searched as much as I can to get help, my game is a racer game, and there are blocks you should jump on,...

View Article

Cannot place checkpoints position into Transform array

I am testing a 2D tower defense game in porblem is that I cannot place checkpoint gameobject positions into Waypoints array which is transform array. Drag and drop also not working and is there any...

View Article



How to find and destroy gameobject with same tag one by one

Hi, i would like to ask if anybody knows a code that at first will find objects to their transform by using the gameobjectfindtag(), the idea here is to find and destroy the gameobject taged as enemy...

View Article
Browsing latest articles
Browse All 95 View Live




Latest Images