|
Description: I want to make a building by script. THe building has its parts as a flat, a parvis, a ground floor, a second floor etc. In the script below i made functions for each part of the building. Then in the main function start() i create these parts and next i try to combine them under their 'father object' flat. Here's the script: Is there something wrong with the code according to what i want to do? Thanks in advance.
(comments are locked)
|
|
In the last section of your code you set the flat to be the child of every object in turn. You have to reverse this. Call the Flat() function first. Then you can set the Flat to be the parent of each object directly in the respective function. Example: I see your point, thanks. There's another problem btw. I have an exception: "Assets/IonianHouse.js(23,42): UCE0001: ';' expected. Insert a semicolon at the end." (IonianHouse is the name of the file.js) And marks that line: "var aColumns : GameObject[3];" ,where i create my array. Do you know why?
May 07 '12 at 10:33 PM
velv
Try
May 08 '12 at 09:59 AM
Piflik
I made some changes to my Array type: var aColumns = new Array(); //size=3 aColumns.Push(cloneColumn); //sets the 1st column to the initial position for(var i =1; i<=3; i++) { aColumns.Push(cloneColumn); //sets the rest 3 columns to the new given positions if(flat != null){ //child the new object to the flat cloneColumn.parent = flat; } } Now i get the exception: "Unknown identifier: 'Instantiate'." -- As for the parenting, is it: tempObjLC.parent = flat; or: tempObjLC.transform.parent = flat; (?)
May 08 '12 at 12:34 PM
velv
(comments are locked)
|
