Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.


  • Content Count

  • Joined

  • Last visited

  • Days Won


YoungDeveloper last won the day on March 17 2018

YoungDeveloper had the most liked content!

Community Reputation

862 Excellent

About YoungDeveloper

  • Rank
    Optimization Junky
  • Birthday 05/06/1992

Profile Information

  • Gender
  • Location:
  • Interests
    Game Development

Contact Methods

Recent Profile Visitors

4,020 profile views
  1. Not completely sure about the question, but usually overflow in these situations is called when property calls itself [SerializedField]private bool _toggle = false; public bool toggle{ get{ return _toggle; } set{ _toggle = value; gameOobject.SetActive(_toggle)); //you playerprefs stuff for saving } } you can also add OnValidate so if you toggle 'toggle' inside editor all he logic will be called accordingly #if UNITY_EDITOR private void OnValidate(){ this.toggle = toggle; } #endif
  2. Only 5 people on this forum want some sort of game? Lets just say i will be making giveaways of various games, and largest votes win, i have done similar questions on other forums and discord groups, thought id ask here too
  3. I'd like to know what games you would want to have in your steam/origin/microsoft library. Maybe they are too expensive or maybe just cant get to part of actually buying them Write one or couple games as you want I'll start, id like to have cuphead fortnite (full game) rocket league
  4. Script disable is done just like you did script.enabled = false; to disable gameObject you use gameObject.SetActive(false); if you enable/disable gameObject, components will not be automatically enabled note that script enable/disable affects only for unity ghost methods, such as OnEnable(), Update(), OnTriggerEnter() etc
  5. You sure your ui button event is even fired? Add Debug.Log("works"); inside DisableScript to see if your ui button even works edit: if nothing appears in Console the problem is most likely that your scene does not contain EventSystem or your button doesnt even have raycastable element (such as image or RawImage) or you have some 3rd invisible ui element on top of it blocking the click ray
  6. With buttons you basically have two options to flow your logic 1. is using method unity tutorial gave you which is basically you have to manually drag and drop and select function 2. you subscribe to your buttons manually using event listeners. Right now you should stick to 1. one You should probably create new method, which basically is a wrapper for method i wrote before public void Spawn(){ Spawn(transform.position); } and as your function select Spawn()
  7. Unity has very good tutorials on this matter, they also many others check them out https://unity3d.com/learn/tutorials/topics/user-interface-ui/ui-button
  8. Note that Spawn(transform.position); will work corectly on if script executing it exists on player gameobject, if it exists in ui it will spawn in probbaly far away where ui recttransform position is if it on ui simply add public Transform player; //drag and drop player transform and then call it Spawn(player.position);
  9. public GameObject _prefab; //drag and drop your prefab from inspector //method which spawn things public void Spawn(Vector3 position){ GameObject go = Instantiate(_prefab); go.transform.position = position; } //on button click simply call Spawn(transform.position); //if you want custom position to spawn on, you could also create overloads for rotation etc Spawn(new Vector3(0f, 5f, 0f));
  10. Simplest solution for you right now would be using Update(), float as timer and add component This approach basically 1. adds component to a gameobject 2. runs update and reduces timer 3. kill itself, disables gameobject when timer finishes Its usage would be //OnButtonClick gameObject.AddComponent<MyClass>(); //Or if you want to specify other timer gameObject.AddComponent<MyClass>().SetTimer(4f); //Heres the pseudo private float timerCur = 2f; private const float Min = 0f; private void Awake(){ //check for already existing timers on this gameobject if(GetTimerCount() > 1){ Debug.LogWarning("Timer component cannot contain duplicates"); Finish(); } } private void Update(){ UpdateTimer(); } private int GetTimerCount(){ return gameObject.GetComponents<MyClass>().Length; } private void UpdateTimer(){ timerCur -= Time.deltaTime; if(timerCur <= Min){ Finish(); } } public void Finish(){ Destroy(this); gameObject.SetActive(false); } public void SetTimer(float time){ timerCur = time; }
  11. Now that you're saying yea unity might not have best support for this indeed you are right, thanks for sharing the code!
  12. Why would you limit yourself to logitech hardware only, why not just use Input.GetAxis("Mouse ScrollWheel")?
  13. Hi, i created au community group on unitys new service unity connect, feel free to join if you want. https://connect.unity.com/g/5ae1b479880c6400185ea662
  • Create New...