Quantcast
Channel: Questions in topic: "dynamically"
Browsing all 152 articles
Browse latest View live

Can you use "GetComponent" dynamically?

I'm using: public GameObject target; private ValueField valueField; void Awake (){ valueField = target.GetComponent(); } void OnMouseDown () { valueField.addValue(value); } It works great. I can set...

View Article



How to assign a gameObject to prefab (in-game via code)?

Hi , I wondered if anyone knew how to assign a gameObject to a prefab via code in-game. What I'm doing at the moment is letting the user make a car in one scene(garage) and I want to transfer the car...

View Article

How to Load and Play an .ogv movie in MovieTexture

Hi, I want the user to be able to choose an .ogv file from their hard drive and then play it in a MovieTexture on the GUI. So far I've got working: Being able to get the path of an .ogv file: string...

View Article

How to create object in 3d/2d dynamically ?

Hi everyone ! I'm very new to Unity ! I am working a simple game where there is requirement for dynamic creation of objects. To be exact need to create pipes from user swipes so that objects could move...

View Article

How to make a mesh programatically.

I want to make a mesh dynamically .Is there any method or code snippet which can help me. I want to make a cube.

View Article


Switch to New Shader and Back to Original object's Shader in C# Script

So I want to be able to switch between a new shader for a gameobject, and then back to the original shader within a C# script. I can't seem to find an answer to work. I already have all of the...

View Article

Removing null entries from a lists that is itself part of a list.

Hello, I have a grid in which the user can place items, and lists are created whenever items of the same type are placed next to each other. Due to the grid size, many of these lists are dynamically...

View Article

How to assign a gameobject to a script that is added dynamically

How to assign a gameobject to a script that is added dynamically? I have this script that after a certain event adds a script to a gameobject. This script needs a target(gameobject). Here are the...

View Article


Is there a way to dynamically populate game objects via texture maps?

I am still very new to Unity but really enjoying its interface. I was curious if there was a way to dynamically populate gameObjects using texture maps. For example, we have a plane that has a...

View Article


Make car CenterOfMass change dynamically

Can some one give me directions to start a dynamically script to change the center of mass, like car simulation, in real life if you are ate like 20 km/h and max turn it will only skid because the...

View Article

Attaching an object to bone dynamically

Here's the code: public var weapon:GameObject; public var weaponBone:Transform; function Start () { // instantiate the weapon prefab var weaponTransform:Transform = Instantiate(weapon,...

View Article

Create a TreePrototype causes a object null exception

**Hi**, well I'm creating a procedural world generation, and well I like to add some trees to my terrains (is in plurar because I'm using a terrain tile system)... Well, the Docs and community hasn't...

View Article

Is there a way to determine width of GUI.TextField?

Hi, I want to create dynamical text input field that will expand depending on how many character are inputed. Is there a way to determine its current width in pixels? Why do I need it? As far as I know...

View Article


Change MeshColliders mesh dynamically

I have made water surface class Like this: public class Water : MonoBehaviour { public float scale = 0.375f; public float speed = 1.0f; public float noiseStrength = 0.75f; public float noiseStepSpeed =...

View Article

delegate event OnCollisionEnter...

Hi, I have one script attached to the MainCamera. I create all objects dynamically. Now I want in this unique script, to add some collision detection to some objects. I want to use something like:...

View Article


how to change the mesh of the human character by scripting in unity 4 ?

Hai everybody...... iam trying to change the mesh of the human character while running of the game. for example my player is in running state if player takes any special power ,player size want to...

View Article

How to dynamically change a movie texture from Streaming Assets for a windows...

HI, I know there is a lot on the topic out there but I am about to pull my hair out trying to solve this. I need to be able to change movie textures that are stored in the StreamingAssets folder, not...

View Article


dynamically painting on an object @ runtime

Hello People I am trying to basically make a coloring book, where the user can paint on an object with touch. I think this would use recasting, but I am not sure how Texture2D.SetPixel works for this...

View Article

For Loop creating GUI.Label Dynamically

The problem I am having is that I am unable to create the GUI.labels dynamically. Ths code below is running through the loop, there are items in playerInv.carrying and the code is in OnGUI too. So...

View Article

Slow Performance to dynamically create meshes in Editor.

Hello, I am working on a game where most parts of the world are dynamically generated from custom data. During the work in the editor, the meshes needs to be present. I am talking in the magnitude of...

View Article
Browsing all 152 articles
Browse latest View live




Latest Images