private void Start() { floatingPos = transform.position + new Vector3(0, floatingDist, 0); //if return before setting executable to true, the whole script won't work. if (FindObjectOfType <PFManager>() == null) { Debug.LogWarning("This scene lacks a object containing PFManager, thus the " + GetType().Name + ".cs won't work."); return; } thePlatformerManager = FindObjectOfType <PFManager>(); executable = true; /* * if (!managerObj) * { * Debug.LogWarning("The " + GetType().Name + " in " + name + " doesn't setup managerObj. This will make " + GetType().Name + " don't work."); * return; * } * if (managerObj.GetComponent<PFManager>() == null) * { * Debug.LogWarning("Warning: object " + name + " has wrong managerObj set. Set it with the right object with PFManager script, otherwise it won't work." ); * return; * } * thePlatformerManager = managerObj.GetComponent<PFManager>(); * //if return before this line, it won't be executable. * * executable = true; */ }
private void Start() { exist = this; if (checkTheseState.Count == 0) { Debug.Log(GetType().Name + ": checkTheseState not assigned. Will inherit ones from players."); Player[] l = GameSystemManager.exist.GetPlayerList(); if (l != null) { foreach (Player p in l) { if (p != null && p.gameObject != null) { checkTheseState.Add(p.gameObject); } } } } foreach (GameObject obj in checkTheseState) { if (obj == null) { Debug.LogError(GetType().Name + " error: didn't assign all of checkTheseState!"); } } }
//initialization void Start() { //debug: the platformerManager should be the right manager. if (FindObjectOfType <PFManager>() == null) { Debug.LogWarning("This scene lacks a object containing PFManager.cs, thus the " + GetType().Name + ".cs won't work."); return; } thePlatformerManager = FindObjectOfType <PFManager>(); executable = true; }
void Start() { if (platformerManager == null) { Debug.Log(GetType().Name + " reporting: looks like " + name + " didn't assign PFManager. Script will try to find one."); platformerManager = FindObjectOfType <PFManager>(); if (platformerManager == null) { Debug.LogWarning(GetType().Name + " warning: failed to find PFManager in Scene. Unable to work."); enabled = false; } } }