c# - Unity - How to change what GameObjects are visible with button click events? -


i newbie in unity working on augmented reality project showing 3d objects based on marker working fine. show different objects based on click events

here scenario did far:

  • i created 4 different scenes 3d objects markers
  • made 1 canvas frame put 3 buttons on
  • in each button click loading next scene, below code wrote. problem is showing black screen instead of loading new objects. don't want load camera again. can me this?

    using system.collections; using system.collections.generic; using unityengine; using unityengine.scenemanagement; // <<<<<< add this.  public class button_1 : monobehaviour {   public void button_click()  { debug.log("hello, world!"); // application.loadlevel("multi target"); scenemanager.loadscene("multitarget_1");            // <<<< this.      }       public void button_click2()      {     debug.log("hello, world!"); // application.loadscene("multi target_1"); scenemanager.loadscene("nameofscene");            // <<<< this.     }     public void button_click3()   {     debug.log("hello, world!");     application.loadlevel("multi target_2");    }    public void button_string(string msg)  {   debug.log("hello, all!");   application.loadlevel("multi target_1");   } } 

image

hi think can fix project grouping , hiding gameobject. more simple think... write sample code... , add link on how group object if need on that... augmented reality developer understand problem having.... hope help..

url: https://www.youtube.com/watch?v=mp62cck-qtc

using system.collections; using system.collections.generic; using unityengine; using unityengine.scenemanagement; // <<<<<< add this.     public class button_1 : monobehaviour {  public gameobject multitarget_1, nameofscene,multi_target_2,multi_target_1;   public void button_click()  {     debug.log("hello, world!");     hideall();       multitarget_1.setactive(true);      }       public void button_click2()      {     debug.log("hello, world!");     hideall();     nameofscene.setactive(true);     }     public void button_click3()   {     debug.log("hello, world!");     hideall();     multi_target_2.setactive(true);    }    public void button_string(string msg)  {   debug.log("hello, all!");     hideall();     multi_target_1.setactive(true);   }   //call hide  public void hideall(){     multitarget_1.setactive(false);     nameofscene.setactive(false);     multi_target_2.setactive(false);     multi_target_1.setactive(false);  } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -