- Home /
Script outdated i think, Unity 4 - Compiler errors galore
I got this a while back and it worked before, now i am still a noob(new) but i managed to fix most of the errors. The easy ones where, Random.insideUnitSphere error, just changed it to (UnityEngine.Random.insideUnitSphere) in like every damn script uggh...
Now i have a new error, it seems to be randomly killing the sound too?
this.tmpPrefab = (GameObject)Resources.Load(DataHolder.Weapon(selection).GetPrefabPath()+DataHolder.Weapon(selection).prefabName, typeof(GameObject));
}
this.tmpPrefab = (GameObject)EditorGUILayout.ObjectField("Prefab", this.tmpPrefab, typeof(GameObject), GUILayout.Width(pw.mWidth*2));
if(this.tmpPrefab) DataHolder.Weapon(selection).prefabName = this.tmpPrefab.name;
else DataHolder.Weapon(selection).prefabName = ""
It says: CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete
Do you have the using directive for UnityEngine and/or UnityEditor in the beginning of your scripts? If you do, and you still have to specifically access the namespace it is indeed strange...
Answer by Sjiggle · Jul 04, 2013 at 02:37 PM
You probably need
this.tmpPrefab = (GameObject)EditorGUILayout.ObjectField("Prefab", this.tmpPrefab, typeof(GameObject), true, GUILayout.Width(pw.mWidth*2));
There's a new parameter introduced a few months ago. This is the link to the documentation on this function: click
The sound problem I don't know, but I guess you should make sure errors do not occur before concluding what influences what.
@ Sjiggle yeah thanks it fixed it, and i was partly right the no sound was because of the script, just not that script lol. I recently added a pause menu script i found it looks like it worked well but now i see it messes up the world sounds :( it sucks, because i got it from here, http://wiki.unity3d.com/index.php?title=Pause$$anonymous$$enu so i thought it would be working 100%
Glad to help. I'd appreciate you marking my answer as "the answer" if you feel it answered your problem.
For your sound issue I'd advice posting a new question, since it's a totally different topic.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Enter Trigger, display Text, then delete object 1 Answer
Only access door if it's not locked? 1 Answer
Digital Clock: Time.time > 60 2 Answers
Where do I assign GUI scripts? 1 Answer