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

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


Detect a gameObject's tag via OnCollisionEnter()

Hi, I am trying to detect the tag of a gameObject when it collides with another object. Here is my script so far: function OnCollisionEnter (collision:Collision) { if (collision.gameObject.tag ==...

View Article

[C#] Raycasts and Object Tags

I have this code that cast three rays in font of an ai to check if there if something there. then if something is there. Physics.Raycast(transform.position, left, out lhit, StayD);...

View Article

How can I get a reference to a gameobject in my C# script?

I currently have the following: public List myWalls; And in the unity property inspactor script definition area I have: My Walls Element 0: Wall1 Element 1: Wall2 Element 2: Wall3 Now I would like to...

View Article
Browsing all 95 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>