Author Topic: Cant build my Unity project after receiving an ambiguous error  (Read 2115 times)

mythikos

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 18
    • View Profile
Cant build my Unity project after receiving an ambiguous error
« on: September 14, 2016, 09:39:03 PM »
I was working on my project and everything was working fine. Quite randomly, I started getting this error:
  1. Assets/Scripts/Environment/Door.cs(25,28): error CS0117: `TNet.TNObject' does not contain a definition for `GetUniqueID'

Im not sure what happened but I was not even messing with my door script. The even stranger thing is the game can be run in the unity editor but I cant build it to run it standalone anymore without getting the above error. I have tried deleting TNet and re-importing it and it didnt fix anything. The code that is throwing the error:

  1.     void Awake()
  2.     {
  3.         tno = GetComponent<TNObject>();
  4.         tno.uid = TNObject.GetUniqueID();
  5.     }
  6.  

Again, it was working in both the editor and standalone builds just fine and then now I am getting this error. Any idea what might be going on? I feel like it might have something to do with script execution order but I am unsure.

Edit: I am using TNet3. I am running Unity 5.3.5f1.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cant build my Unity project after receiving an ambiguous error
« Reply #1 on: September 17, 2016, 12:40:09 AM »
GetUniqueID() is an internal TNObject function available only in the editor. You can go to it to see it in an #if UNITY_EDITOR define block. Why are you using it in your own custom class? It's not meant to be used externally.

mythikos

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 18
    • View Profile
Re: Cant build my Unity project after receiving an ambiguous error
« Reply #2 on: September 17, 2016, 03:12:38 PM »
GetUniqueID() is an internal TNObject function available only in the editor. You can go to it to see it in an #if UNITY_EDITOR define block. Why are you using it in your own custom class? It's not meant to be used externally.

That is because there are certain objects that need to be networked on the map that are not created via TNManager.Instatiate but I want them to have a unique values (and I have never been a fan of assigning values like that manually).

What would your suggestion be in this instance?

mythikos

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 18
    • View Profile
Re: Cant build my Unity project after receiving an ambiguous error
« Reply #3 on: September 17, 2016, 03:40:17 PM »
Alternatively, is there unforeseen harm in removing the GetUniqueID() function from the if UNITY_EDITOR block?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cant build my Unity project after receiving an ambiguous error
« Reply #4 on: September 18, 2016, 07:30:01 PM »
GetUniqueID() will give you different results on different clients. It's an editor-only function, not meant for play time at all. Its sole purpose is to create unique IDs for static objects. So no, it should not come out of its editor-only block.

If you want an object to have a unique ID, then you need to either use TNManager.Instantiate (= dynamic object), or have them be present as a part of the scene from the very start (= static object).