Unity Build Error [initialzeOnLoadAttribute]



  • Unity Build Error [initialzeOnLoadAttribute] in Assets\Tilt Five\Scripts\Wand\WandDevice.cs (97,6) error CS0246. The type of namespace name 'InitializeOnLoadAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Any help would be good thanks.

    Tom
    Edit* I'm using latest drivers and SDK & Unity 2021.3.2f1

    Edit2* I tried creating an empty project with just the Tilt Five prototype in the scene, plus a cube. Building that worked. So I imported Unitys new Input System & then tried to build it and it failed in the same way.

    Any help would be appreciated.



  • I just signed up for the forums (my first post).

    I hear your frustration about the error and I hear your irritation over the "go to the discord server" rebuff.

    No one (developer or not) should have to go through the trouble of chasing solutions whether here in the forum or on yet another discord server.

    TiltFive should have at least one developer whose sole job is to go through the developer experience with the code in hand on each and every release of any work product to prevent situations like this from cropping up.

    These errors hinder everyone who has spent good money and are not investing development time on the platform.

    ZERO FRICTION should be a mantra.
    Zero friction translates into more customers, plain and simple.
    Friction is what crippled RIM the Blackberry guys.

    Back to your showstopper -- Unity's new input system has problems -- it is not just you.

    The typical work around is this:

    Go to Edit on the top menu bar, click on Project Settings (near the bottom of the long dropdown), select Player (about halfway down the list), then under Configuration you will see a choice for "Active Input Handling".
    Click on the dropdown and choose "both"

    Now your project will use both input systems and should stop complaining or at least give you a different error to troubleshoot.

    I noticed this error can also be caused by more than one event handler in a scene so if you have been tinkering around with grabbing parts of different scenes and copying them over into your project, be sure to check for that as well.
    Thanks,
    Richard



  • Yes, I encountered that too. I modified it to be:
    #if UNITY_EDITOR
    [InitializeOnLoad]
    #endif
    I reported in over in #sdk-talk in discord. Hopefully a fix is put in.



  • The most active place is on the discord server. Most only use this site to
    make collections of different advice, since this site is low traffic. Most probably use this site as a FAQ list, of answers that should be remembered.



  • So, am I the only one then?
    I'm kind of surprised no one has said anything on this topic at all.
    Quite happy to be told what I'm doing wrong if that's the case.
    But it is kind of annoying that I can't build any of the demo's I've made.


Log in to reply