Hi,
I Created an Normal .CS Script for getting the instance
whenever i called the particular function in following script.
public class Indexer
{
private static Indexer instance = null;
public static Indexer GetInstance()
{
if(instance == null)
{
instance = new Indexer();
}
return instance;
}
}
Trying to call GetInstance() in to the Class which derives Monobehaviour like below:
private Indexer index;
public class Model : Monobehaviour
{
void Start ()
{
index = Indexer.GetInstance ();
}
}
I am doing this process when user swithces from one scene to antoher scene.(say, Menu to Game scene).
But, because of this line [index = Indexer.GetInstance ();]
it hangs and crahses unity many times.
Can anyone help to solve this issue. . ?
Yeah, you're right. I assumed he already got it to compile and the issues are just typos that were introduced when posting the example here. It's good you're pointing them out, though. I didn't notice them at all at first.
– Simon_Says