- Home /
This question was
closed Sep 18, 2014 at 03:06 PM by
CrilleStyles for the following reason:
Edit: I just had to destroy the manager
This post has been wikified, any user with enough reputation can edit it.
Question by
CrilleStyles · Sep 18, 2014 at 02:43 PM ·
errorspawnloadlevel
On carachterspawn level load error?
Warning: this following question might be unclear.
I made something and I'm not sure why I can't move or why the entire scene lags when I spawn. Any ideas? I have my scrips here:
#pragma strict
var Spotlight : GameObject;
var isClass1 : boolean = false;
var isClass2 : boolean = false;
var OtherOBJ : GameObject;
function Start ()
{
Spotlight.SetActive(false);
}
function OnMouseEnter ()
{
Spotlight.SetActive(true);
Debug.Log("Entered collider");
}
function OnMouseExit ()
{
Spotlight.SetActive(false);
Debug.Log("Exited collider");
}
function OnMouseUp ()
{
Debug.Log("Clicked box");
Selected();
}
function Selected()
{
if (isClass1 == true)
{
var script: Manager = OtherOBJ.GetComponent(Manager);
script.spawnClass1 = true;
}
if (isClass2 == true)
{
script.spawnClass2 = true;
}
}
#pragma strict
var spawnClass1 : boolean = false;
var spawnClass2 : boolean = false;
var Class1 : GameObject;
var Class2 : GameObject;
function Update()
{
if(spawnClass1 == true)
{
Debug.Log("Will Spawn 1");
LoadLevel();
}
if(spawnClass2 == true)
{
Debug.Log("Will Spawn 2");
LoadLevel();
}
}
function LoadLevel()
{
DontDestroyOnLoad(gameObject);
Application.LoadLevel("Test range");
Spawn();
}
function Spawn()
{
if(spawnClass1 == true)
{
Debug.Log("Spawned 1");
Instantiate (Class1, Vector3(473, 44, 1213), Quaternion.identity);
}
if(spawnClass2 == true)
{
Debug.Log("Spawned 2");
Instantiate (Class2, Vector3(473, 44, 1213), Quaternion.identity);
}
}
I got some screen shots to about how it shold look like and what it looks like.
what it looks liek.jpg
(159.0 kB)
how it really should look.jpg
(140.4 kB)
Comment
Follow this Question
Related Questions
SendMessage setName has no receiver! 1 Answer
Is there anything wrong with this script? It used to work but now it doesn't. 2 Answers
Spawn Script Issue 0 Answers
iOS FPS Kit 0 Answers
Error Code BCE0044 1 Answer