Looking For Anything Specific?

Header Ads

Assets\Standard Assets\Utility\SimpleActivatorMenu.cs(11,16): GUIText has been removed. Use UI.Text instead.

Problem:
Assets\Standard Assets\Utility\SimpleActivatorMenu.cs(11,16): error CS0619: 'GUIText' is obsolete: 'GUIText has been removed. Use UI.Text instead.'


Solution:

-- so here is my solution
  • in both SimpleActivatorMenu.cs and ForcedReset.cs paste the following at the top "using UnityEngine.UI;"
  • where the originally suggested changes from GUITexture to UI.Texture and GUIText to UI.Text, I just removed the UI, as in the post link above!
now my game mode will play!!!



Search for SimpleActivatorMenu.cs
And change the code to this below.
I had this error today.
I added:

  1. using UnityEngine.UI;



and then changed:
public GUIText camSwitchButton;
to:

  1. public Text camSwitchButton;






==================================================================


  1. //ForcedReset.cs


  2. using System;

  3. using UnityEngine;

  4. using UnityEngine.SceneManagement;

  5. using UnityStandardAssets.CrossPlatformInput;

  6. using UnityEngine.UI;

  7. //change GUITexture to Image

  8. [RequireComponent(typeof (Image))]


  9. public class ForcedReset : MonoBehaviour

  10. {

  11. private void Update()

  12. {

  13. // if we have forced a reset ...

  14. if (CrossPlatformInputManager.GetButtonDown("ResetObject"))

  15. {

  16. //... reload the scene

  17. SceneManager.LoadScene(SceneManager.GetSceneAt(0).name);

  18. }

  19. }

  20. }



  21. //////////////////////////////////

  22. //SimpleActivatorMenu.cs


  23. using System;

  24. using UnityEngine;

  25. using UnityEngine.UI;


  26. namespace UnityStandardAssets.Utility

  27. {

  28. public class SimpleActivatorMenu : MonoBehaviour

  29. {

  30. //// change GUIText to TEXT

  31. public Text camSwitchButton;



  32. public GameObject[] objects;



  33. private int m_CurrentActiveObject;



  34. private void OnEnable()

  35. {

  36. // active object starts from first in array

  37. m_CurrentActiveObject = 0;

  38. camSwitchButton.text = objects[m_CurrentActiveObject].name;

  39. }



  40. public void NextCamera()

  41. {

  42. int nextactiveobject = m_CurrentActiveObject + 1 >= objects.Length ? 0 : m_CurrentActiveObject + 1;


  43. for (int i = 0; i < objects.Length; i++)

  44. {

  45. objects[i].SetActive(i == nextactiveobject);

  46. }


  47. m_CurrentActiveObject = nextactiveobject;

  48. camSwitchButton.text = objects[m_CurrentActiveObject].name;

  49. }

  50. }

  51. }












Post a Comment

0 Comments