Author Topic: Question re overriding Start in TNBehaviour (might be a noob Unity Q)  (Read 580 times)

scornflake

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 15
    • View Profile
Hi,

Trying to provide an IEnumerator Start() method on an object inheriting from TNBehaviour.

Getting:
`TNetPlayerObject.Start()': return type must be `void' to match overridden member `TNet.TNBehaviour.Start()' (CS0508) (Assembly-CSharp)

The TNBehaviour declares this Start to return void.
Hmm.

Anyway around this?  I need to delay the stuff in Start() until I've joined the channel completely, i.e.:

  1. while (TNManager.isJoiningChannel) {
  2.         yield return new WaitForSeconds (0.05f);
  3. }
  4.  

scornflake

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 15
    • View Profile
Re: Question re overriding Start in TNBehaviour (might be a noob Unity Q)
« Reply #1 on: April 05, 2017, 01:02:09 AM »
for the moment I've simply copied and created my own TNBehaviour subclass. Pretty straightforward. Just wanting to know if there's a better way?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Question re overriding Start in TNBehaviour (might be a noob Unity Q)
« Reply #2 on: April 07, 2017, 06:50:49 PM »
You don't have to derive from TNBehaviour. It's just a convenience class that adds some useful things. You can achieve the same effect by creating a normal MonoBehaviour. You can also just start a coroutine in Start() instead of turning Start() into a coroutine.