Instantiate an object and give it a new value for a variable
Hi I have a code that spawns in objects and destroys them after a while, but the code works in a way where the original gets destroyed aswell and the cloning code no longer works. // Start is called...
View ArticleMake a projectile teleport to the player instead of cloning. (2d)
I'm trying to make a 2d platformed. In it the player can shoot a projectile. I've been following a tutorial where they make it so the bullet makes a clone of itself. I want it so the bullet can...
View ArticleInfinite Road Clone Duplication
I am making an infinite driving game and created a script to create road forward as the current road is seen. For some reason the roads keep duplicating underneath themselves as well as forward and...
View ArticleObejcts from Assets are not showing after cloning project,after cloning a...
Hey guys. Because of some issues I had to clone my whole project new. After cloning all Game Objects in the scenes created with assets are not showing.... All the colliders are showing but not the...
View Articlei attach the prefab, but when i hit play, its not the prefab anymore
hello! an island has 4 borders. borders keep the player inside the island. there are also 4 buttons near our island. those buttons instantiate other islands. when i instantiate some islands, the...
View ArticleHow do I Instantiate an object that is half the size of the parent object?
I am trying to make a enemy that splits in Unity 3D when I press the key K. While doing this I have run into several problems. Firstly, whenever I try to make a copy of the object it always copies into...
View ArticleAny collision with my cloned objects only affects the last clone created
I have an enemy object with scripts and components and a figure. I clone this object when the game starts. I have an empty spawner game object that creates these clones and a raycast from my gun object...
View Article,My clone sprite is disapeared.
I wanna do a infinite map but when i put the floor this disapeared, im using GameManager in a prefab, and visual studio 2019. Here is the code. The classes is in spanish ![alt text][1] This happen when...
View ArticleInstantiated prefab clones don't collide like the original
I am making a pong like game and when the ball hits the left wall or the right wall, I destroy the gameobject and instantiate it again on position (0, 0, 0) and add speed to it. However, the...
View ArticleHow to delete prefab clones?,Can I delete Trail Renderer prefab clones?
Hello, I am currently creating an app where the user can draw on the screen after pressing a button. I also wanted to have an erase function where once the user is done drawing they can click another...
View ArticleGameObject not getting passed trough
I have a GameObject Tower which needs to find all enemies in its area and fire bullets at it but the enemy gameObject is not passed trough in the bullet script somehow. Tower script: private void...
View ArticleClones not using animator and enabling scripts?
I'm trying to make my enemy freeze when it gets in contact with an ice projectile. Everything works no errors except the animator doesn't play the animations and the script doesn't get enabled /...
View ArticleWhat can I do to make the objects I instantiated move with the background?
I created an empty object called SpawnManager. I wrote the code for instantiating and moving and added prefabs. But since the instantiated objects are not cloned as children of SpawnManager object, I...
View Articlecloned bullet will not destroy on collision
hey, so when i try and use the code below to destroy my cloned bullet it doesnt destroy, it doesnt even fire the onCollisionEnter event so i am very confused. the bullet has a collider and a rigidbody...
View ArticlePrevent more then one player clone in a scene
My Player is cloning at run time occasionally and when I switch scenes it duplicates im using. a game manager to instantiate when respawn is called also im using easysave3. using System.Collections;...
View ArticleHow to make multiple game object work with the same scripts?
Hello everyone, this is my second project in Unity so I'm very noob at this and desperately looking for help. I'm trying to make a game where different type of enemies will be coming to the screen and...
View ArticleLooking to destroy clone of gameobject without destroying original
Basic idea: Crate prefab spawns. If you double click on the crate, it instantiates a larger version of that, a sort of 'zoom in' on it, to show details. If you then click outside of the panel, it...
View ArticleHow do I assign a child to a clone prefab?,
Hello. I have a script that clones the prefab Cell. And after that, I need a prefab of Gold to be randomly placed in these cells. The problem is that I cannot make the cell become the Parent and the...
View ArticleDestroy button only destroys the last clone of object
Hello, I am working on a 2d isometric grid building system, and I have encountered a problem with destroying already placed objects. So I have a prefab with a panel and buttons, one button for...
View ArticleTrying to Instantiate() an object without cloning the code
I'm trying to make an object that'll duplicate itself in random positions, but when I duplicate it, it also duplicates the code. The clone then starts the code which makes another code, exponentially...
View Article