بدأت في تخصص الالعاب علي ادراك ووصلت الي مرحلة GUIالمشكلة هي انه يعطيني من وقتها خطأ ولا اجد اي حل
وهذا هو الكود 2d
usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclass playercontroler :MonoBehaviour{publicfloat speed;publicSpriteRenderer sr;publicRigidbody2D rb;publicfloat jump;int health;int score;publicAnimator anim;publicText healthText;publicText scoreText;// Start is called before the first frame updatevoidStart(){
health =100;
healthText.text ="health:"+ health +"%";
scoreText.text ="score: "+ score ;}// Update is called once per framevoidUpdate(){if(Input.GetAxis("Jump")>0)
rb.velocity =newVector2(0, jump);
anim.SetFloat("Speed",Mathf.Abs(rb.velocity.x));}privatevoidFixedUpdate(){if(Input.GetAxis("Horizontal")>0){//transform.Translate(speed, 0, 0);
rb.velocity =newVector2(speed *Input.GetAxis("Horizontal"), rb.velocity.y);
sr.flipX =false;}elseif(Input.GetAxis("Horizontal")<0){
rb.velocity =newVector2(speed *Input.GetAxis("Horizontal"), rb.velocity.y);
sr.flipX =true;}}privatevoidOnTriggerEnter2D(Collider2D collision){if(collision.CompareTag("health")){
health +=10;
healthText.text ="health:"+ health +"%";Destroy(collision.gameObject);}elseif(collision.CompareTag("score")){
score +=10;Destroy(collision.gameObject);
scoreText.text ="score: "+ score;}elseif(collision.CompareTag("Enemy")){if(transform.position.y > collision.transform.position.y){Destroy(collision.gameObject);}else{
health -=10;
healthText.text ="health:"+ health +"%";}}}}
وهذه الرسائل
Library\PackageCache\com.unity.2d.common@4.1.0\Runtime\InternalBridge\InternalEngineBridge.cs(21,35): error CS1061: 'SpriteRenderer' does not contain a definition for 'IsUsingDeformableBuffer' and no accessible extension method 'IsUsingDeformableBuffer' accepting a first argument of type 'SpriteRenderer' could be found (are you missing a using directive or an assembly reference?)
Invalid serialized file header. File: "VirtualArtifacts/Primary/ada555936059fa149bb48537842ee230".
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[])
Unknown error occurred while loading 'Library/Artifacts/f2/f27b79827eb6ce6ac46b0f92687c2a6e'.
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[])
Could not load Packages/com.unity.timeline/Editor/StyleSheets/Extensions/common.uss
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[])
Invalid serialized file header. File: "VirtualArtifacts/Primary/e98085123be873947970c4f10099a39a".
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[])
Unknown error occurred while loading 'Library/Artifacts/35/35c86656bde22d12ad98ab8a3a14d6dc'.
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[])
Could not load Packages/com.unity.timeline/Editor/StyleSheets/Extensions/light.uss
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[])
Assets\script\playercontact.cs(1,27): error CS1003: Syntax error, '(' expected
Assets\script\playercontact.cs(1,27): error CS1026: ) expected
Assets\script\playercontact.cs(2,1): error CS1529: A using clause must precede all other elements defined in the namespace except extern alias declarations
Assets\script\playercontact.cs(3,1): error CS1529: A using clause must precede all other elements defined in the namespace except extern alias declarations
All compiler errors have to be fixed before you can enter playmode!
UnityEditor.SceneView:ShowCompileErrorNotification ()
Assets\script\playercontact.cs(15,12): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)
السؤال
زهراء الربيع
بدأت في تخصص الالعاب علي ادراك ووصلت الي مرحلة GUIالمشكلة هي انه يعطيني من وقتها خطأ ولا اجد اي حل
وهذا هو الكود 2d
وهذه الرسائل
تنسيق الشيفرة
0 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.