Author Topic: Very Strange errors  (Read 6188 times)

Scobbo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Very Strange errors
« on: October 27, 2012, 09:24:40 PM »
Hello,
      I was using the Space game Starter kit and all I have done is add one script to the spaceship prefab that (is supposed to) change the power generation out put. It doesn't do this, however it keeps throwing errors on scripts I have not even opened. and memory addresses and it is always different. Here is the latest message that I have recieved.

  1. !CompareApproximately (det, 1.0F, .005f)
  2. UnityEngine.Quaternion:INTERNAL_CALL_LookRotation(Vector3&, Vector3&)
  3. UnityEngine.Quaternion:LookRotation(Vector3, Vector3) (at C:\BuildAgent\work\14194e8ce88cdf47\Runtime\ExportGenerated\Editor\Math.cs:555)
  4. ChaseCamera:UpdateTransform(Single) (at Assets\SGSK\Game\Scripts\Game\ChaseCamera.cs:107)
  5. ChaseCamera:OnLateUpdate() (at Assets\SGSK\Game\Scripts\Game\ChaseCamera.cs:49)
  6. SGUpdateManager:LateUpdate() (at Assets\SGSK\Game\Scripts\Common\Internal\SGUpdateManager.cs:121)

Here is the script that I added in it's entirety.

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerShip : MonoBehaviour {
  5.        
  6.         public string chassis;
  7.         string chassisClass;
  8.         string[] weapons;
  9.         string[] utilities;
  10.         public string engine;
  11.         public string shield;
  12.         public string hull;
  13.        
  14.         // Use this for initialization
  15.         void Start () {
  16.                 GameObject playerShip = GameObject.Find("Spaceship");
  17.                 PowerGenerator powerGen = playerShip.GetComponent<PowerGenerator>();
  18.                 switch(engine)
  19.                 {
  20.                 case "small":
  21.                         powerGen.maxReserve = 200f;
  22.                         break;
  23.                 case "big":
  24.                         powerGen.maxReserve = 1000f;
  25.                         break;
  26.                 default:
  27.                         powerGen.maxReserve = 10f;
  28.                         break;
  29.                 }
  30.         }
  31.        
  32.         // Update is called once per frame
  33.         void Update () {
  34.                
  35.         }
  36. }
  37.  

Can someone please tell me what is going on?
Kind regards,
Scobbo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Very Strange errors
« Reply #1 on: October 28, 2012, 04:17:22 AM »
The problem isn't in your script. Did you move the camera at some point? Perhaps placing it in the same spot as the spaceship? The errors appear when trying to calculate the look rotation for the camera.

Scobbo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Very Strange errors
« Reply #2 on: October 28, 2012, 10:36:22 PM »
Hi! Thanks for the quick reply. I moved the spawn point parent object and deleted the space station and asteroids and enemy ships (after copying the scene to a new game folder) but when I moved the spawn point all together. However even with all these errors the values aren't being changed. Is there another script setting these variables? The only thing I could think off is that the spawn script is setting them but I couldn't see it. Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Very Strange errors
« Reply #3 on: October 29, 2012, 05:27:28 AM »
All I can suggest is look at ChaseCamera's UpdateTransform function. It tries to set Quaternion.LookRotation to something -- what is the value? Where is it coming from and why is it broken? Since you've changed the setup extensively, only you can look into the code and answer this question now.