Quantcast
Browsing all 508 articles
Browse latest View live

Instantiated Object turning off scripts and audio source?(Solved)

My player object has started to act weirdly and now when I respawn the object (after a death) the instantiated version has some components turned off. In this case its main script and audio source....

View Article


Robocraft-Like Block Builder

Does there exist, for free or for pay, any scripts out there that would mimic Robocraft's create-a-ship? I'm not a coder and I was wanting to find some kind of framework to test some block designs to...

View Article


When does a material gets cloned?

Sometimes I have an object with its material named "something - Clone". So, as the title states, how does it determine when to create a clone and when not?

View Article

How to follow clone object with camera.

I am trying to figure out how to make my camera follow a cloned prefab, but to no avail. Is there something I should add to the code to help it find cloned objects? using UnityEngine; using...

View Article

Variable being shared between clones

var selected : boolean = false; .. function Update () { .. if(Input.GetMouseButtonDown(0)){ if(Physics2D.OverlapPoint(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { selected = !selected; } }...

View Article


Script finds a non-existing object

I have a really weird problem with my game. I'm using GameObject.FindWithTag in the Update() to find the player transform for my camera script. This is obviously very basic stuff. But now, for some...

View Article

How to clone a gameobject in runtime (not with instantiating)

Hi, I'm instantiating a game object and performing a boolean mesh operation on it (effectively making a hole in it) and saving it as a new game object (all in runtime). How can I clone this new game...

View Article

Editing (clone) properties after runtime

So I have an object with a disabled script in scene and a UI button that enables it by dragging the original object into the inspector and setting it to "Script.bool.enabled" so that the user can...

View Article


(solved)Instantiate prefab "on top" of previous one

Hey everyone! As a coding beginner, I'm stuck with this problem, and I bet you guys can help me out easily. I have several Prefabs containing a plane with an animated textures on it. When I press the...

View Article


Instantiate clones 4 times?

Hey I've got this code to instanstiate an object, it worked fine the other day. Though now it instantiates the object 4 times instead of just once... Here's my code: var foundation : Transform; var...

View Article

Instantiate gameObject and destroy clone on click

Hi, i want to Instantiate GameObjects from prefabs by a List. This are some kind of units, which will have stats and can do some actions. When one Clone is clicked, only this Clone should get destroyed...

View Article

how to keep cloning even the real one has destroy c#

i try to make infinite object with clone as enemies. But when the real object has been destroyed, cloning has stop. I try this code to clone the object. using UnityEngine; using System.Collections;...

View Article

GameObject parenting during runtime

Hi, this is my very first post in unityAnswers, and I'm quite new to unity. Hope you guys can help me out. Let's say I want multiple prefab object called childTile, it parenting another single prefab...

View Article


Destroy Cloned Object on Collision

hello uniters, i would like to destroy an object that is cloned on collision **the specific object is cloned beforehand, and i would like to destroy the one specific that collides with the player**....

View Article

instantiated gameobjects(clone) don't have components of its original...

Hey guys... I have 10 same objects in scene. I have a script that is attached to all those objects and some of the code of that script is as follows: Destroy (gameObject); Object.Instantiate...

View Article


Moving a transform behaves odd

Working on a 2D game. So I have a Unit object prefab. The unit has a child object with a GUITexture (it's health bar) I move the health bar guitexture if the unit moves like so: public void LateUpdate...

View Article

Copying GameObjects with reference types

I have a MonoBehaviour, which contains nested lists of references to classes. My serialization works fine, but when i copy my GameObject the references in those lists now points to same objects. I...

View Article


Return a Hashtable. Warning: Implicit downcast from Object to String.

Here's the simplified version of the code: var h:Hashtable = new Hashtable(); h = returnHash(); function returnHash():Hashtable{ var h2:Hashtable = new Hashtable(); h2.Add("key",1); return h2; } When I...

View Article

Destroy instantiated object instead of prefab

Hello, I'm trying to write a script that gives the user two choices. The user either chooses left or right and then it repeats. However, I'm trying to do the following: 1. Destroy both objects when the...

View Article

Instantiated GameObject's components are disabled

After I instantiated a Game Object (Sphere), it receives a new name (Sphere (Clone)) and all of its components are disabled except for the mesh renderer. using UnityEngine; using System.Collections;...

View Article
Browsing all 508 articles
Browse latest View live


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