Added check on empty objects
This commit is contained in:
parent
512c035917
commit
2747c1e0af
@ -386,6 +386,8 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void LocalChangeAvatar(GameObject avatarPrefab) {
|
public void LocalChangeAvatar(GameObject avatarPrefab) {
|
||||||
|
if (avatarPrefab == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Animator animator = avatarPrefab.GetComponent<Animator>();
|
Animator animator = avatarPrefab.GetComponent<Animator>();
|
||||||
if (animator == null || animator.avatar == null || !animator.avatar.isValid) {
|
if (animator == null || animator.avatar == null || !animator.avatar.isValid) {
|
||||||
|
@ -112,6 +112,9 @@ namespace Passer.Humanoid {
|
|||||||
/// <param name="gameObject">The GameObject of the Possession to add</param>
|
/// <param name="gameObject">The GameObject of the Possession to add</param>
|
||||||
/// This does nothing if the gamObject is not a Possession
|
/// This does nothing if the gamObject is not a Possession
|
||||||
public void TryAddToPossessions(GameObject gameObject) {
|
public void TryAddToPossessions(GameObject gameObject) {
|
||||||
|
if (gameObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Possessable possession = gameObject.GetComponent<Possessable>();
|
Possessable possession = gameObject.GetComponent<Possessable>();
|
||||||
if (possession == null)
|
if (possession == null)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user