Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by iveldion · Nov 27, 2012 at 12:06 PM · npccompile

"Talking system" whhy when I build all destroy?

Hello,

its my first post on this forum, so I want to greeting with all of us.

I'm creating "Game" on my ingeener project for school, and I have a small problem.

I create: collecting cash and stars system and all work well.

I start create "Talking" Script too and when I done, all work well.

Problem's show, when i using button " build & run ", and:

At start console show me new errors, but on this forum i find resolve.

" if u have this error, in hierarhy do CTRL + A , DELETE, and CTRL + V" All ok i done it, all scipts r in self possition. I Start second time.. and ? And northing ! Unity3d ignore my script, don't do northing, and consolwe dont write any errors.

I start new project, write all from new.. and i have same problem , but before compile all work well ;S

It's my code script's for it:

intera.cs :

Code:

 using UnityEngine;
 
 using System.Collections;
 
  
 
 public class intera : MonoBehaviour {
 
     
 
     private GameObject ply ;
 
     private GameObject cam;
 
         
 
     public GUIText target;
 
     private bool selected =false;
 
     private bool menu =false;
 
     // Use this for initialization
 
     void Start () {
 
     
 
     }
 
     
 
     // Update is called once per frame
 
     void Update () {
 
         renderer.material.color=Color.white;
 
         selected = false; 
 
     }
 
     
 
     
 
         public void OnLookEnter(){
 
             renderer.material.color=Color.red;
 
             target.text ="Nacisnij E by porozmawiac";
 
             selected = true;
 
     }
 
     
 
     void OnGUI(){
 
         ply = GameObject.Find("First Person Controller");
 
         cam = GameObject.Find("Main Camera");
 
         Event e = Event.current;
 
         if(e.isKey && e.character == 'e' && selected ){
 
             //rigidbody.AddForce(Vector3.up*100);
 
             ply.GetComponent<MouseLook>().enabled = false;
 
             ply.GetComponent<CharacterMotor>().enabled = false;
 
             ply.GetComponent<FPSInputController>().enabled = false;
 
             cam.GetComponent<MouseLook>().enabled = false;
 
             Screen.showCursor = true;
 
             menu = true;
 
         }
 
         if(menu){
 
             GUI.Box(new Rect(0, (Screen.height/3)*2,Screen.width, Screen.height/3), " Dialog Test");
 
         
 
         target.enabled = false;
 
             
 
             
 
             if(GUI.Button(new Rect((Screen.width/2)-25,(Screen.height/4)*3, 50, 30), "Talk")){
 
             ply.GetComponent<MouseLook>().enabled = true;
 
             ply.GetComponent<CharacterMotor>().enabled = true;
 
             ply.GetComponent<FPSInputController>().enabled = true;
 
             cam.GetComponent<MouseLook>().enabled = true;
 
             Screen.showCursor = false;
 
             menu = false;
 
             target.enabled = true;
 
         
 
                 
 
                 
 
                 
 
                 }
 
         }
 
         
 
         
 
         
 
     }
 
 }
 selec.cs
 
 Code:  
 

    using UnityEngine;
     
     using System.Collections;
     
      
     
     public class selec : MonoBehaviour {
     
         public RaycastHit hit;
     
         // Use this for initialization
     
         void Awake () {
     
             
     
             Screen.showCursor = false;
     
             
     
         }
     
         
     
         void Start () {
     
         
     
         }
     
         
     
         // Update is called once per frame
     
         void Update () {
     
         Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width/2, Screen.height/2, 0));
     
             if(Physics.Raycast(ray, out hit, 10)){
     
             if(hit.collider.gameObject.GetComponent<intera>() !=null ){     
     
             hit.collider.gameObject.GetComponent<intera>().OnLookEnter();
     
                 }   
     
             }
     
             
     
         }
     
     }
     
 
 poup.cs
 
 Code:  
  

   using UnityEngine;
     
     using System.Collections;
     
      
     
     public class poup : MonoBehaviour {
     
      
     
         // Use this for initialization
     
         void Start () {
     
         
     
         }
     
         
     
         // Update is called once per frame
     
         void Update () {
     
         guiText.text ="";
     
             
     
         }
     
     }

Any1 could help me ?

OFC after resolve my problem, if any1 want to use this script, should feel free.

What I do bad?

Why when i do " play button " all works well but when i compile and run, all destroy.

P.S.

Stars, and cash script work well all time, after Build and before Build.

thx

Michal

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Zombie Round Script Help 1 Answer

Spawn Script Not Working 1 Answer

[SOLVED] Problem with "foreach". 1 Answer

Bullet not moving 1 Answer

mistake in script 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges