hm… i thought i once had a solution, but since i didnt do anything for quite a while, i forgot how to add my own objects via script to the scene.
just like var cube : GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube); but for adding my own asset
thanks in advance,
ello
thank you for the reply… but i dont understand how i can use instantiate with an asset. say my asset is called “ball” how can i use that with instantiate?
thanks,
ello
in script, you define an object as a transform. Then drag an object from either the hierarchy, or the assets to the object.
In the code below, it creates the instance of that object at world center. (you can adjust the position by using the Instantiate to it’s fullest potential…)
var object : Transform;
function Start () {
var instance = Instantiate(object);
}
Object.Instantiate
static function Instantiate (original : Object, position : Vector3, rotation : Quaternion) : Object
hey, thank you very much. now i got it working… really cool