您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字
 
 
 

28 行
513 B

  1. using System;
  2. using UnityEngine;
  3. public class ThereCanBeOnlyOne : MonoBehaviour
  4. {
  5. private void Awake()
  6. {
  7. if (this.Prefab != null)
  8. {
  9. if (!GameObject.Find(this.Prefab.name))
  10. {
  11. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.Prefab);
  12. gameObject.name = this.Prefab.name;
  13. }
  14. }
  15. else
  16. {
  17. UnityEngine.Debug.LogError("Error prefab not set so There Can't Be Only One", this);
  18. }
  19. }
  20. private void Start()
  21. {
  22. }
  23. public GameObject Prefab;
  24. }