nextobject definition in super zombie runner game

Hi guys
i have some error in my scripts for super zombie runner(udemy tutorial 2d)
i couldnet solve the problem…where is my mistake??/

this is the code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class gameobjectutill : MonoBehaviour {
private static Dictionary<RecycleGameObject, objectPool> pools = new Dictionary<RecycleGameObject, objectPool> ();
public static GameObject Instantiate(GameObject prefab,Vector3 pos){
GameObject instance = null;

var recycledScript = prefab.GetComponent ();
if (recycledScript != null) {
var pool = GetObjectpool (recycledScript);
instance = pool.NextObject(pos).gameObject;
} else {
instance = GameObject.Instantiate (prefab);
instance.transform.position = pos;
}

return instance;
}
public static void Destroy(GameObject gameobject){

var recyleGameObject = gameobject.GetComponent ();
if (recyleGameObject != null){
recyleGameObject.Shutdown ();
} else {
GameObject.Destroy (gameobject);
}
}
private static objectPool GetObjectpool(RecycleGameObject refernce){
objectPool pool = null;
if (pools.ContainsKey (refernce)) {
pool = pools [refernce];
}else{
var poolContainer = new GameObject (refernce.gameObject.name + “ObjectPool”);
pool = poolContainer.AddComponent ();
pool.prefab = refernce;
pools.Add (refernce, pool);

}
}
}3897034--331651--1.jpg 3897034--331654--2.jpg

Hello. GameObjetPool function should return value - so compare this function with tutorial one.

sorry…explain more…

You are following video tutorial right? If yes than check this function in tutorial:GetObjectpool()

It missing something like this at the end:

GetObjectpool()
{
//other code
return pool;
}
1 Like

yes.u were right…i found it.thanks pal

hi. wondering, do i need the player, and also looking to extend my game, for an assignment i ma doing for my gaming course from http://www.upskilled.edu.au. so, is there a tutorial to extend and use human and computer a.i. thanks. don’t have a player, do have a player animation. if the up to me tutorial, is better, where can i find this tutorial. thanks.

hi, wondering, doing the super zombie runner, do have a player naimation, but not any player. also need some a.i, scripts for my game, need to do this for an assignment. i am doing for a gaming course. if the ude to me tutorial is better. where to find. thanks.

hi. wondering, do i need a player, and also is there scripts or other tutorials, need to extend the game and do a.i. any ideas. need this for a game assignment doing for a gaming course. thanks.

hi, do i need a player. got the player aniamtion. and also need a.i. scripts, for a assignment doing for a gaming course. any ideas.