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 ArticleNeed 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 ArticleActivate/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 ArticleHow 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 ArticleCollision 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 ArticleProblems 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 ArticleHow 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 ArticleHow 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 ArticleChecking 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 Articleusing 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 ArticleAssigning 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 ArticleAnyone 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 ArticleOnCollisionEnter 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 ArticleMy 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 ArticleGameObject 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 Articlehow 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 ArticleDetect 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 ArticleHow 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