Reputation: 41
The problem I am facing at the moment is that right now I have warnings:
which are created by this code snippet:
But if I correct the code by changing line 24 to:
The result is an error saying that in line 24 the insance is not declared, in the picture is visible that I added the script to my GameObject, but it has no variables filled in.
Been dealing with this for 2 days now, really need your help. Thank you!
Upvotes: 0
Views: 248
Reputation: 976
try this: (dots in wrong position)
#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);
}
}
Upvotes: 0
Reputation: 544
Change all your code with GetCompenent and AddComponent into:
rendCat110 = CatFiltered110.GetComponent<Renderer>();
the .
you have after GetComponent will give you an error.
Upvotes: 1