Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

show instrution image only once

Discussion in 'Scripting' started by Deleted User, Aug 25, 2017.

  1. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Please don't be offended, but if you want to learn all that stuff, you'll need to able to understand and/or look up the terms. I always try to explain everything as simple as possible and sometimes I might not be able to find the correct words/terms either, as English is not my native language.

    We - or at least I - cannot guide you through every single issue that you encounter. As I said earlier, programming (especially the extensive learning phase in the beginning) is much more than just throwing commands into a text editor.

    As for your questions, I was just referring to a simple menu which shows some information about the game itself and the developer(s) etc. Nothing fancy, no interaction needed.

    Kinda like credits, imprints etc.


    Difficult to tell, try to provide as much information as possible.

    What is GlovalValues? It it an instance of any class? Is it a class itself with a static field or property named 'money'?

    Don't get me wrong, I appreciate your effort, but it's time to take a step back to the fundamental basics again.
     
    Deleted User likes this.
  2. Deleted User

    Deleted User

    Guest

    allright . it is now ok . i added class code persistendata to gameobject with CoinExtraAdding script attached to . and now it also consider get component .....as you know! thanks Suddoha,
     
  3. Deleted User

    Deleted User

    Guest

    Suddoha my friend , this is last question and so important :

    i have a gameobject as bicycle. by clicking on ui button it is selected. ok?
    then i have another seprated gameobject which is as bicycle driver . i need whenever player start the game , he or she can choose a bicycle and also a driver for that bicycle . how this is possible?
    i have code like below:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4.  
    5. public class BuyScript : MonoBehaviour {
    6.  
    7.     public Text myText;
    8.     public int myChar;
    9.     public int price;
    10.     public Image myImage;
    11.  
    12.     void Update()
    13.     {
    14.         if (GlobalValues.character == 1 && myChar == 1)
    15.         {
    16.             myText.text = "Selected";
    17.             myImage.color = Color.red;
    18.         }
    19.         else
    20.         {
    21.             myText.text = "Select";
    22.             myImage.color = Color.white;
    23.         }
    24.  
    25.         if (myChar == 2)
    26.         {
    27.             if (GlobalValues.character2Unlocked)
    28.             {
    29.                 if (GlobalValues.character == 2)
    30.                 {
    31.                     myText.text = "Selected";
    32.                     myImage.color = Color.red;
    33.                 }
    34.                 else
    35.                 {
    36.                     myText.text = "Select";
    37.                     myImage.color = Color.white;
    38.                 }
    39.             }
    40.             else
    41.             {
    42.                 myText.text = "" + price;
    43.             }
    44.         }
    now my question is how to match them correctly ? i mean if player choose bicycle number 2 with driver number 5 , how in gameplay scene these two choice are good showed? its hard....
     
  4. Deleted User

    Deleted User

    Guest

    there are three gameobject in the scene and each one has a script attached to. what i need is when game is paused, these three gameobjects script does not work and when game is resumed , then their script work .
    how is possible to make their methods off and on only when game pause panel is shown?

    i created a new gameobject with public gameobject enough for three gameobject and referenced them from inspector
    , but how to control their specific method?
     
  5. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Use a boolean or disable the scripts.
     
    Deleted User likes this.
  6. Deleted User

    Deleted User

    Guest

    thanks for tips . now it is working correctly . so can you give me also a tip about this one which is very hard for me to understand well:

    i have in shop scene ten gameobjects as bicycles.
    i have also there five gameobject as drivers.

    i need if player choose bicycle(whatever) with driver(whatever) , then in gameplay scene , he or she sees correct choices. this one is hard if you help me thanks.
     
  7. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Look up arrays and loops first.

    You can put bicycles in an array and the drivers in an array.
    Then it depends how you'd like to present them to the user, loops will be helpful for this in many cases, especially when it's about dynamic placement or showing one after another.

    When this is done, you'll need a way to accept input from the user, either mouse clicks on the objects or ui elements such as buttons. On selection, it's up to you how you proceed...
     
    Deleted User likes this.
  8. Deleted User

    Deleted User

    Guest

    well , as for presenting section , when player in shop scene clicks on each ui button for different bicycles, from bike 01 untill bike 10, each one wll be set char1 till char10 in one script. the same goes until char15 for the last driver.
    i mean the first 10 chars are related to bikes and from char11 untill char15 are drivers. ok? clear?

    i save each selection with persistant data to disk. but just a question of scene to scene correct showing , how is it possible from Tab A bike... and Tab B driver.... when two choice are made , in gameplay scene these two gameobjects are shown correctly?
    if you need more explainnations please tell me about it . at the moment i am in hrz , a physic master student also is so much busy , but maybe also he helps me . anyway . i look always for your good tips . thanks. Viel Erfolg.
     
  9. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    There are so many ways to implement it...

    - take the selected instance to next scene (using DontDestroyOnload)
    - you could stay within the same scene, disable/destroy the other instances and proceed
    - remember an identifier that's based on the selection and instantiate a prefab that's mapped to this identifier
    - slightly different: get the selection's asset path, load and instantiate it
    - and so on...

    These are just four basic ideas.

    There are lots of tutorials that cover all the features you've been asking about so far.
    You need to learn to search for existing resources, even if it's convenient to just ask here. Also, you need to start to come up with own ideas - once you have an idea, it's easy to do some research about how to approach it.

    Take the examples from above, they're all based on an abstract idea that doesn't even require coding knowledge.

    First one: "I need to take the gameobject to another scene". Google that, and it'll throw tons of results at you.
    Second: "Just keep this one active, get rid (disable or destroy) other gameobjects." Google these keyword and you'll get results + API documentation.

    And so on and so forth.
     
    Deleted User likes this.
  10. Deleted User

    Deleted User

    Guest

    you give help so good , then i would say you it is happening to me and i understand that i am learning programming, like 8 or 9 hours ago , thinking about a logic for game and without asking here , i tried some possibilities and they worked. so here , really forum worths and teaches good , of course forum is people kindness like you but my big problem is i dont know for going on with game different mechanism , where should i put approriate codes.
    here there are two scenes . in scene A there are two tabs . each tab has ui button which present a bike or driver. thats ok.
    but using an array (array has a bestimmt definition) . but how to assign those tabs things to array and send them to other scene ...this process is hard . if you give me a snippet , i follow that. like always just thanks.

    P.S : Also , when game play scene starts , i have a player prefab in a specific position . this player has animator component which switches different player colours and animations.
    now i just need that choice of shop scene is correctly reflected by this player prefab .
     
  11. Errorsatz

    Errorsatz

    Joined:
    Aug 8, 2012
    Posts:
    555
    Fortunately, there are a large number of tutorials about using arrays in C#. Here's one from MSDN:
    https://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx

    And here's a more general one about how the concept of arrays works:
    https://www.tutorialspoint.com/computer_programming/computer_programming_arrays.htm

    Now you might think "That's a long read, won't it be faster just to have someone give me code for this?" But this is going to come up again and again. Your choices are:
    1) Spend some time to learn how arrays work.
    2) Spend 10x as much time asking people for array code.
     
    Deleted User likes this.
  12. Deleted User

    Deleted User

    Guest

    yes , i read tutorials and youtube tutorials are good . however in this case , can you tell me , how would you assign game object from scene 1 to player prefab gameobject in scene 2 ? also this player prefab has animator . thanks.
     
  13. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    If you've seen and read tutorials, you should know how it works, if not, you have to dig a little deeper.

    I told you about different ways to get you started. Now try to figure out how you could implement that into your existing project.
     
  14. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I read this entire thread, and noticed something:
    first, the OP is asking "Thanks, just 1 more question"
    then, several questions later " Just one more.."
    :)
    This is why he's trying to nudge you towards learning, and the fundamentals :)

    With the knowledge of baser concepts and ideas, you can formulate more of your own solutions for not just your 1 question(s), but for many related situations/questions.

    Just an observation :) Good luck with your game.
     
    Deleted User likes this.
  15. Deleted User

    Deleted User

    Guest

  16. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    I know, I'm aware of that. :D
    But I'm pretty patient and just try to still kindly help with a few information. But that's the reason why I neither take the time get into details nor post code samples.

    There have been people that topped all of that, so it's still okay. :)
     
  17. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Oh ya.. I mean it's all good :)