Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 yomo710 · May 27, 2011 at 03:23 PM · errorbce0019fpstutorial

Fps Error, Frame Is not a member.

I am trying to make the fps with the fps tutorial, i get this error and it wont let me test my game:

Assets/WeaponScripts/FPSPlayer.js(124,31): BCE0019: 'frame' is not a member of 'UnityEngine.Texture2D'

My code var maximumHitPoints = 100.0; var hitPoints = 100.0;

 var bulletGUI : GUIText;
 var rocketGUI : GUITexture;
 var healthGUI : GUITexture;
 
 var walkSounds : AudioClip[];
 var painLittle : AudioClip;
 var painBig : AudioClip;
 var die : AudioClip;
 var audioStepLength = 0.3;
 
 private var machineGun : MachineGun;
 private var rocketLauncher : RocketLauncher;
 private var healthGUIWidth = 0.0;
 private var gotHitTimer = -1.0;
 
 function Start ()
 {
 machineGun = GetComponentInChildren(MachineGun);
 rocketLauncher = GetComponentInChildren(RocketLauncher);
 
 PlayStepSounds();
 
 healthGUIWidth = healthGUI.pixelInset.width;
 }
 
 function ApplyDamage (damage : float) {
 if (hitPoints < 0.0)
 return;
 
 // Apply damage
 hitPoints -= damage;
 
 // Play pain sound when getting hit - but don't play so often
 if (Time.time > gotHitTimer && painBig && painLittle)
 {
 // Play a big pain sound
 if (hitPoints < maximumHitPoints * 0.2 || damage > 20)
 {
 audio.PlayOneShot(painBig, 1.0 / audio.volume);
 gotHitTimer = Time.time + Random.Range(painBig.length * 2, painBig.length * 3);
 }
 // Play a small pain sound
 else
 {
 audio.PlayOneShot(painLittle, 1.0 / audio.volume);
 gotHitTimer = Time.time + Random.Range(painLittle.length * 2, painLittle.length * 3);
 }
 }
 
 // Are we dead?
 if (hitPoints < 0.0)
 Die();
 }
 
 function Die ()
 {
 if (die)
 AudioSource.PlayClipAtPoint(die, transform.position);
 
 // Disable all script behaviours (Essentially deactivating player control)
 var coms : Component[] = GetComponentsInChildren(MonoBehaviour);
 for (var b in coms)
 {
 var p : MonoBehaviour = b as MonoBehaviour;
 if (p)
 p.enabled = false;
 }
 
 LevelLoadFade.FadeAndLoadLevel(Application.loadedL evel, Color.white, 2.0);
 }
 
 function LateUpdate ()
 {
 // Update gui every frame
 // We do this in late update to make sure machine guns etc. were already executed
 UpdateGUI();
 }
 
 function PlayStepSounds ()
 {
 var controller : CharacterController = GetComponent(CharacterController);
 
 while (true)
 {
 if (controller.isGrounded && controller.velocity.magnitude > 0.3)
 {
 audio.clip = walkSounds[Random.Range(0, walkSounds.length)];
 audio.Play();
 yield WaitForSeconds(audioStepLength);
 }
 else
 {
 yield;
 }
 }
 }
 
 
 function UpdateGUI ()
 {
 // Update health gui
 // The health gui is rendered using a overlay texture which is scaled down based on health
 // - Calculate fraction of how much health we have left (0...1)
 var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);
 // - Adjust maximum pixel inset based on it
 healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;
 
 // Update machine gun gui
 // Machine gun gui is simply drawn with a bullet counter text
 if (machineGun)
 {
 bulletGUI.text = machineGun.GetBulletsLeft().ToString();
 }
 
 // Update rocket gui
 // We use a quicktime movie with 20 frames to display how many are left
 // The alpha of the movie changes every frame thus rockets get masked out when changing the frame.
 if (rocketLauncher)
 {
 var rocketTexture : Texture2D = rocketGUI.texture;
 rocketTexture.frame = rocketLauncher.ammoCount;
 }
 } 
Comment
Add comment · Show 1
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
avatar image GesterX · May 27, 2011 at 05:14 PM 0
Share

edited for you so the code is formatted

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by willgoldstone · May 27, 2011 at 04:05 PM

The FPS tutorial is ageing somewhat now and may well contain deprecated code. From a quick google of this I noticed this forum post that confirms .frame as a property of a texture2d went out a while back -

http://forum.unity3d.com/threads/6662-texture2d.frame-in-2.0

and checking the script reference shows that this is not the case either -

http://unity3d.com/support/documentation/ScriptReference/Texture2D.html

So you would need to achieve whatever it is you're going for another way. If its ammo displaying, simply update the texture with a differing texture dependent upon your ammo variable. Also when posting to Unity answers, make sure to paste code in as code and not normal text otherwise it ends up difficult to read and you are less likely to be answered by others.

Good luck with your project.

Comment
Add comment · Show 2 · Share
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
avatar image GesterX · May 27, 2011 at 05:15 PM 0
Share

There really should be a note on the tutorials page that states the tutorials are for previous versions of Unity - Especially when you consider that it will be one of the first places a new user looks to learn the ropes...

avatar image Mike 3 · May 28, 2011 at 01:16 PM 0
Share

For what it's worth - the page is only linked from the unity 2 section of the site, which shows it as being old.

$$anonymous$$y guess is that people keep finding it through google and the like though, skipping that

avatar image
0

Answer by yomo710 · May 28, 2011 at 01:07 PM

SO what do i do

Comment
Add comment · Show 1 · Share
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
avatar image FLASHDENMARK · May 28, 2011 at 02:01 PM 0
Share

First of all take the time to understand this site before you throw your self out in it.

What you are posting is in a answers section what you are posting is NOT a answer, but a comment. So do leave comments in a comment-box and answers in a answer-box.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Error mesige with array functions 3 Answers

I got a major question 1 Answer

Accessing array in another script - Error message 2 Answers

Missile script is suddenly giving errors 1 Answer

Class error: BCE0019: 'xxxx' is not a member of 'Object'. 0 Answers


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