- Home /
Question by
Sylvir · Apr 26, 2015 at 07:09 PM ·
gamecontroller
trying to set up the game controller from the unity persisting data tutorial
this is the code that i have, and i am almost positive that I have the same as he shows on the screen, but i am getting these errors.. error on line 18, 25 saying argument #1 cannon convert object espression to type unityEngine.object. another error says the best overload method match for unity engine object dontdestroyonload(unity.Engine.object) has some invalid arguments, and finally expression denotes a type where a variable value or method group was expected.
using UnityEngine;
using System.Collections;
public class GameControl : MonoBehaviour {
public static GameControl control;
public float fish;
public float fishPerTap;
void Awake ()
{
if (control == null)
{
DontDestroyOnLoad (GameObject);
control = this;
}
else if (control != this)
{
Destroy(gameObject);
}
}
}
my question is if you can see where i am messed up on this code. it seemed pretty simple. my first thought is that i was missing a using " fill in the blank" at the top, but he didnt have anything extra added.
Comment