答案 0 :(得分:1)
将GetCompenent和AddComponent的所有代码更改为:
rendCat110 = CatFiltered110.GetComponent<Renderer>();
GetComponent之后的.
会给你一个错误。
答案 1 :(得分:0)
试试这个: (点位置错误)
#pragma strict
var CatClickFinished : CatClickFinished;
var passToDisable;
var rendCat110 : Renderer;
var rendCat210 : Renderer;
var enablePrintedPage : enablePrintedPage;
var enableCats;
var increment : int = 0;
var CatFiltered110 : GameObject;
var CatFiltered210 : GameObject;
var enabledCat110210 : boolean = false;
function Start () {
CatFiltered110 = GameObject.Find("CatFiltered1.10");
rendCat110 = CatFiltered110.GetComponent<Renderer>();
CatFiltered210 = GameObject.Find("CatFiltered2.10");
rendCat210 = CatFiltered210.GetComponent<Renderer>();
}
function Update () {
GameObject.Find("CatFiltered110").AddComponent<enablePrintedPage>();
enableCats = enablePrintedPage.enableCats;
GameObject.Find("CatFiltered110").AddComponent<CatClickFinished>();
passToDisable = CatClickFinished.passToDisable;
SymbolsEnabled();
DisableSprite();
}
function OnMouseOver(){
if(Input.GetMouseButton(0)){
rendCat110.enabled = true;
rendCat210.enabled = true;
enabledCat110210 = true;
}
}
function SymbolsEnabled(){
if(enableCats && increment == 0){
var cat : BoxCollider = gameObject.AddComponent<BoxCollider>(); //enabled box colliders on cat symbols
increment = 1;
}
}
function DisableSprite(){
if(passToDisable){
Destroy(gameObject);
}
}