Screen clear using tags
I am trying to create a screen clear for my enemies but for the ones in the camera's view. The main issue is that all the solutions give me a half way result. My button Code void ScreenClear() {...
View ArticleHelp nothing is working
My project is multiplayer and I am trying to get a child object of the player that spawns in I literally have no idea how I would do this since the player chooses when he or she spawns in so I need a...
View ArticleFinding all grandchild objects with specific tag?
I can't seem to find an answer for this anywhere, so I figured I'd ask. I have a single game object with several child objects. Each of those child objects has a child object of their own with a...
View ArticleHow to "FindWithTag" multiple items?
I know there are a few other threads about it and I've mostly pieced together the information but I'm still a bit of a beginner in coding so I was wondering if someone could help me put together this...
View ArticleHow to change variables inside FindGameObjectsWithTag objects
so i am instantiating bombs in different location and set their tag to "Bomb" and i want when the player scores more the speed of the bombs will increase so i made a switch statement in which i put the...
View ArticleFind a gameobject with the same position
I want to check if another gameobject has the same position! public void update() { if (GameObject.FindGameObjectWithTag("wall").transform.localPosition == gameObject.transform.localPosition) {...
View ArticleCompare GameObject with an array
I have been looking all over the place to see if i can get an answer to this, can i take a GameObject that i am looping already and compare that into another array? I first find all the GameObjects in...
View ArticleWhen 0 elements with a tag, get a value of 13
I'm trying to count out the number of enemies in a scene by using tags, but I keep getting the value 13 when there are no enemies. I put the check in the Start() function, and I'm still getting 13...
View ArticleHow to get if all all objects are destroyed to start another wave
I am making a simple shooter. I want the following: to keep track of current enemies. if there are no enemies I want to start the new wave. My game controller code currently looks like this: using...
View ArticleFindGameObjectWithTag in an Array (C#)
I'm having a lil bit of trouble because it says on my error **'Cannot implicitly convert type `UnityEngine.GameObject` ' to ' `UnityEngine.GameObject[]` '** Here's what my script looks like; public...
View ArticleIgnoreCollision doesnt work
if i click right mouse button the player and object can collid with each other` GameObject player; // Use this for initialization void Start () { player = GameObject.FindGameObjectWithTag("Player"); }...
View ArticleTurn on/off renderer for objects found with "FindGameObjectsWithTag"
Hello, I'm trying to display a level of a game by enabling the mesh renderer for all the objects in the level once the player reaches a certain checkpoint and collides with it, but I can't seem to make...
View ArticleCode for setting AudioSource.volume for various audio sources works in the...
I have a UI slider acting as a volume control to adjust the volume of the music in my game. The music comes from various different AudioSources so the slider passes its value to the following function:...
View ArticleTagged objects not returning value
Hi all! I got some code from the documentation and I'm evidently using it wrong as I get the error 'not all code paths return a value'. I'm trying to get the furthest player object (as there are...
View ArticleFindGameObjectsWithTag returning any object with a tag
I am having a strange issue where FindGameObjectsWithTag is returning any GameObject that has a tag of any value. Example: private GameObject[] interactiveObjects; void Start() { interactiveObjects =...
View ArticleGetcomponent error?
Let's say I have an object A, and an object B. B contains a script called "Test" right? B has a tag called "Player" Now in A, on my start method, it does this: if...
View ArticleRTS Resource Droppoff
Im making a RTS game with resource collecting units, when they are full they are put into a list so only one truck gets to move on the drive thru resource droppoff ramp at once. I have an idea on how...
View ArticleWhat's the most efficient way of finding child objects at runtime?
I have a prefab that will be added to X amount of objects, and these prefabs have Y amount of child objects. These child objects have a few objects under them too. What I would like to is to be able to...
View ArticleNot finding closest Object with tag player.
I need this script to when the zombie spawns in to find the closest object with the name player within 10 meters, and set that object as the target. Right now it is not picking anything up with the tag...
View Articlefindgameobjectwithtag only working sometimes
Hello, for some reason it appears that findgameobjectwithtag does not work sometimes. I receive this error only sometimes: **NullReferenceException: Object reference not set to an instance of an...
View Article