Make middles work

SetUpOnsets() only sets up the onsets (a la the name), so I need another function that does Middles.

Woooo I did it! A thing I’d like to do is go back to WordDictAdd.SetUpOnsets() and script the super repetitive stuff. I never learned how to do that and that’d be a thing that’d make me happy to do. #todo

I’d also like to go back and see why GameManager.instance.levelCounter isn’t working where I thought it should have. I had to call GameManager.InitGame() an additional time in the Propogate.cs script to make it so the menu buttons worked.

Note: I also had to reset each of the counters inside Start() in WordDictAdd, or else they got too high and stopped calling the right index.

 

Trigger Check Answers button to appear

So now that I have the show/hide button working, and I know how to trigger collisions, I need to make the button only show up when each of the slots has been filled.

A question for myself:

  • does each slot need to be filled with a like color?
    • I’m not going to do this for now. I want to see how kids interact with it, and if they start learning the patterns on there own without too many initial restrictions.

Implementation questions:

  • how do I make sure that the slot is actually being filled, rather than just having been collided with?
  • Do I have the collisions/fillings count to 15, and on 15, the button shows up?
    • This could be something where if there are 15 collisions simultaneously, then the check button appears
  • Or do I have something arranged more individually, box collider by box collider …
  • ¬†Or, this might not exactly be about collisions, but about slots being filled

http://answers.unity3d.com/questions/756868/2d-collision-detecting-simultaneous-collisions.html

http://answers.unity3d.com/questions/574630/find-objects-colliding-with-collider.html

This is a super cute interaction, and might be useful for me to reread in the future:

https://forum.unity3d.com/threads/how-do-i-check-for-two-boxcollider2d-overlapping.232646/

A lot of stuff was recommending Physics.OverlapSphere , which does maybe what I want but with a sphere.

I looked in the rest of the Physics command, and found Physics.CheckBox

https://docs.unity3d.com/ScriptReference/Physics.CheckBox.html

This might be it – gonna give it a shot.

Joao just suggested these too ideas:

  • there’s also OnTriggerExit (cool I didn’t know!!!), so I could tally on trigger enters and on trigger exits and when it hits 15, I know they’re done

Boolean – is something placed here?

  • Joao also pointed out – but what if a letter block overlaps two box colliders ūüôĀ Which will almost definitely happen, unless I really change how I’m doing this, and I don’t want to bc I don’t want it to be too rigid bc it’s like 6 year-olds using this

OHHHH – I only need a single box collider, over the entire frame where the answer slots are, and then all I need is for all of the letter blocks to be inside it. Doesn’t need to be 15, doesn’t need to be individualized, just once all of the letter blocks collide or overlap with it simultaneously, then the check box appears. Really cool how that idea occurred to me while talking with Joao! Social thinking about coding problems is helpful and happy.

http://answers.unity3d.com/questions/459219/check-that-an-object-is-within-the-bounds-of-a-tri.html

Hmmm …¬†blocks are getting stuck in the box collider.

http://answers.unity3d.com/questions/733114/ontriggerstay-or-ontriggerenter.html

Keeping Track of Targets in a Trigger

Do I want a script on the collider block, or a script on each of the letter blocks? (Or … no matter where the script is, what direction is it going in – for every letter block, is it in the collider currently? )

blocks are getting stuck in the box collider:

PROBLEM: Because raycast from Move Object and Play Sound was hitting the box collider instead.
SOLUTION : move box collider to -1000, and then it works again.
This could also be potentially solved by using Raycast All, which might end up being necessary if there’s no way to satisfy all the z requirements.

So I’ve gotten it down to the point that being left in the boxcollider is making the letter blocks freeze and not be consistent about playing their own sounds. This happens even when I remove my collision script. I’ve removed the sprite component, rigidbody2D, and checked and unchecked “istrigger”. Hoping that the site below helps. This feels oddly familiar and maybe like something I’ve solved in the past, possibly in PuzzleBot.

http://answers.unity3d.com/questions/689414/unity-2d-freezing-player-in-position-on-collision.html

When you raycast, it figures out all the things that are intersecting it. So it finds the first object (box collider) instead of finding the letters block (which it needs to in order for Move Object and Play Sound).

Raycast – can always deal with z things by just looking at all of the things. Raycast can give a bunch of different objects. –> there’s a Raycast All, which gives you a bunch of Raycast hits, which I can try to use at some point if my z stuff gets sad.

#todo – so keep an eye on if it ever happens that the order z needs to be in for every different thing isn’t possible.

 

 

make it so blocks don’t overlap so weirdly:¬†

PROBLEM: blocks overlap weirdly bc they’re all at the same z level, which means that the text overlaps with one of the colors behind it. It looks strange and isn’t useful.
SOLUTION: Make onsets a different z level (10) than middles (20), which should be a different z level than codas (30).

 

Render Check/Hide button when all 15 are in the box collider

For this one, I can use the same render script I used for the answer text inside the Check/Hide button itself.

Okay, so now I need to access the Check/Hide button from the collider.  OR I could put the collider script on the Check/Hide button.

https://forum.unity3d.com/threads/cant-gameobject-find-on-ui-text.293008/

Okay I need the collider script on the collider bc of this:

    void OnTriggerEnter2D(Collider2D other)

So instead I’m going to use this:

http://answers.unity3d.com/questions/1203661/how-to-make-buttons-disappear-and-reappear-in-the.html

Noooo this is still for gameobjects, not for buttons.

Huh – why is the child of the button not getting enabled? I’ll just hack it and enable it specifically in the code.

 

Show/hide button

So now I’m thinking that I shouldn’t use z to have the text be behind the buttons, but instead have it be the mesh renderer be enabled or disabled depending on need, by tag, like I used to do in the other Show/Hide button.

https://docs.unity3d.com/ScriptReference/Renderer-enabled.html

I made the show/hide button work to render and not render the answers over the answer flashcards!

It requires that the answers be tagged as “Answer”, so the prefab will need to be updated for that. #todo

#todo – I would also like the text to look more child-friendly.

A cool thing is that in googling this rendering thing, I also found the function at the bottom, that toggles the rendering every second. I’d like to use that to remind users to hit buttons – or at least at the start, to hit the first answer button. #todo

There’s a chance I might be better off with a brief tutorial, but the flashing buttons could be a segue (or could be good in addition to it).

The next thing I want to do for the show/hide button is :

  • only have it appear when all of the box colliders for the answer slots are filled in (what if there has been a collision but it hasn’t *stayed* there)
  • and then have the name of the show button change to “hide” in context – and change the name to “check” instead of show
  • make the show/hide button look more attractive
  • make it flash when it shows up, and say “check your answers!”
  • after that, it’d be nice if there were a tally of how many correct slots you did – __/15.
  • but it’s unclear how much some of those goals matter in comparison to getting it massively expanded in terms of content

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Show : MonoBehaviour
{
    private Renderer rend;
    Button myButton;
    private GameObject[] AnswerTexts;

    void Start()
    {

        myButton = GetComponent<Button>(); // access button component 
        myButton.onClick.AddListener(() => ShowHide());
        AnswerTexts = GameObject.FindGameObjectsWithTag(Answer);
        Debug.Log (Answer);   

        foreach (GameObject answer in AnswerTexts) 
        {
            rend = answer.GetComponent<Renderer>();
            rend.enabled = true;

//                    r.enabled = false;
        }

    }
        

        void ShowHide()
        {
            
    //        GameObject[] consClusts = GameObject.FindGameObjectsWithTag(ConsCluster);
          
            foreach (GameObject answer in AnswerTexts)
            {
                
                if (answer.GetComponent<MeshRenderer>().enabled == true)
                {
                    answer.GetComponent<MeshRenderer>().enabled = false;
                    foreach (Renderer r in answer.GetComponentsInChildren<Renderer>())
                    {
                        r.enabled = false;
                    }
                }
    
                else if (answer.GetComponent<MeshRenderer>().enabled == false)
                    {
                    answer.GetComponent<MeshRenderer>().enabled = true;
                    foreach (Renderer r in answer.GetComponentsInChildren<Renderer>())
                        {
                            r.enabled = true;
                        }
    
                    }
            }
    
    
        }
    

//    // Toggle the Objects visibility each second.
//    void Update()
//    {
//        // Find out whether current second is odd or even
//        bool oddeven = Mathf.FloorToInt(Time.time) % 2 == 0;
//
//        // Enable renderer accordingly
//        rend.enabled = oddeven;
//    }
//}

}

 

 

 

 

Making better prefabs

Before, I did a thing that probably wasn’t the most advisable – have a mesh for the background of my buttons, with the color material added on, and then scaled it like crazy to make it the size I wanted. That was then embedded in my prefabs for each moveable letter.

Unsurprisingly, this got wonky in the following ways:

  • every time unity updates, it lost its link to the material, or to the prefab, and turned bright pink
  • it was scaled bonkers-like, making all other scaling around it really annoying (particularly since text, notoriously tricky to scale, is involved)
  • It just didn’t seem like the most elegant way to do this

So today I finally decided to fix this. I didn’t do it in the most elegant way, but I used Grab to get the color and shape out of it (I actually like the color and shape for a beginning draft, and it’s what I prototyped with and it worked, so no need to change it now). I checked the scale size on Unity to find out that it was approximately 4/3 x/y. Then I sized and resized it in GIMP, and brought each png back as a prefab and compared. Wound up being pretty perfect at GIMP’s canvas size 122 x 88 pixels at 144 ppi.

8-16-17

I believe that I can’t add in prefabs after the fact – is that true?

 

https://www.google.com/search?rlz=1C5CHFA_enUS757US757&q=how+to+make+text+mesh+appear+above+sprite&oq=how+to+make+text+mesh+appear+above+sprite&gs_l=psy-ab.3…615.615.0.3390.1.1.0.0.0.0.437.437.4-1.1.0….0…1.1.64.psy-ab..0.0.0.HlFg82oOUVE

I followed these instructions to get my textmesh to appear above my new 2D sprite. The textmesh is childed to the sprite. The sprite is Z=0, textmesh is Z= -1.

The sprite I’m using is from the png¬†onset-block-updated-122-88. ¬†I’m going to child that to an empty game object just named “1” so that my scripts work with the onsets.

With the textmesh childed to the sprite, the sprite is no longer involved in the scale shenanigans I’ve been using to make the font quality look nice. I’d like to return to this, and to try out TextMeshPro again, bc this is some buuuullshit that I have to do this wonky thing with the text and there HAS to be a better way, right?

Alright, now I have an empty gameobject parent (1), that has childed to it the sprite (onset-block-updated-122-88) [gotta name that better] and the text (Text).

It needs the following components:

  • Box Collider 2D [for Move Object Script]
  • Rigid Body 2D [for Move Object Script]
  • Move Object Script
  • Play Sound Child Script

This way, the children only have one component each. For the sprite, it’s just a sprite renderer. For the text, it’s just the textmesh.

Hopefully this will keep it simpler!

So on the one hand, my next goal could be:

Completing this for all of the prefabs inside this scene, so that everything looks beautiful. That includes:

  • middle block (same as onset but different color)
  • end block (same as onset but different color)
  • 3 answer slots
  • flashcard (this one is particularly inelegant, with the textmesh offscreen – I should probably just make the textmesh in the back, and I could consider having a button to press to show the answers (which should only be possible if all the answer slots are filled in)
    • This is an exciting idea, because it’s one step easier than checking the answers and giving feedback. It basically just gives *you* the answer, and then you can correct it. Not sure how this would work with kids, but there’s a chance it’d be good. It’s at least a thing to make and see how it works – maybe the feedback system isn’t even necessary and this is enough. But at the least it’d be a useful step as a comparison in prototyping.
    • This is also useful to think through because when I redo the flashcard, it should be with this in mind.
    • Also, how do kids know they’re supposed to press the flashcard? Wouldn’t that be nice if it was more obvious, or if there was a brief tutorial

Question for self – if I have the textmesh overlaying the sprites as *part* of the prefab, will that mean that when/if I change the prefab, I’ll have to change all of the text again? That feels unfair. And feels like it relates back to – I should have the text brought in automatically. Maybe I should go ahead and build it that way, and hope that I can do it well and it passes the app store. Cuz otherwise I’m going to spend an ungodly amount of time putting text in.

Hm. Nah. One thing at a time, Brittany. Let’s get this in the app store and build up features from there.

Next step – make a good prefab for the middle bits.

  • get png from the onset
  • get Grab of the middle block, to get the color
  • use GIMP to change the purple to orange
  • save as .xcf
  • export as .png
  • put in sprites

Then, make a duplicate of the onset prefab, rename to middle, and switch out the sprite. Everything else should be the same.

#todo – this is probably a great instance of a branching prefab. Or a linked prefab. I don’t know how to do those, so I’m just going to have them be entirely independent. Excited to someday make these link up.

As part of this, I should decide on some naming conventions and keep them stable. For instance “onset-block-updated-122-88” is not a great name. It should probably just be

  • onset-block-122-88

OR

  • OnsetBlock

Unsure if I should keep in it what size it is, bc it was actually a real pain to figure out the size. I think that means I keep it in. How about:

OnsetBlock-122×88

That feels optimally clear without looking too awful. Still looks kinda bad. Okay I’m gonna try that out with the middle blocks and see if it feels good.

Actually it looks like textmesh content doesn’t change with prefabs. This is GREAT news for me in this instance – I just realized my textmesh color was grey-ish, and that it was making the blocks look weird. I changed the onset prefab textmesh color to white (FFFFFFFF) and ALL of the onsets changed. Didn’t need to even press any buttons. YAY

Current question:

what should z be on gameobject

I dislike how when I zoom in on a gameobject, it disappears bc of where its z is. That’s a frustrating thing to happen in a 2D space, but I guess I get it. #todo – I’m unsure what to put my z objects at. It feels weird to put them artificially back (z = high positive number like 20) just so that I can zoom in, but it’s also annoying having them disappear when I zoom. I don’t really understand spacial relationships very well so this might be interacting with it.

Also somehow all my onset collider boxes are totally off. Gonna see if changing the prefab works. YAY – I couldn’t change the collider box *in* the prefab, but I made an instance of it in my scene, changed the collider box, and hit “Apply” and everything else changed. Crucially, the textmesh contents did NOT change (like before). This is very exciting.

So I need to change the sprite names, both under Onsets AND middle block. cuz they both wound up being wacky. Going to finish Ends first.

Curious, I’d never noticed before that the end blocks were a different size than the others. Or, I noticed, and didn’t care, cuz this was some pretty rapid prototyping that I’m leveling up!

Alright, this is good progress. Slow, but good. Gonna take a 30-min lunch break and set this laptop aside so I get out of work mode. And charge this laptop, too. Maybe it’d be good for me to switch locations after lunch.

Nevermind, the kitten’s asleep on my foot, so I’m never moving again. The only things in reach are popcorn, red wine, and my computer, so I think I’m all set! Time to get working again.

  • onset:¬†purple, hex color :¬†8A3FE7FF
  • middle:¬†orange, hex color :¬†F85757FF (I think?)
  • coda: green, hex color :¬†3BCC36FF

I don’t *quite* know how to put that into GIMP, but it seems to be working to just use the grab method followed by color picker.

#todo – make kerning / vertical and horizontal centering consistent with fonts on these buttons. In the meantime, I’m going to just eyeball it.

Okay I just want to reiterate that now that I learned how to deploy prefabs better, they are AMAZING HOLY COW. This little “apply” button is the BEST THING EVER.

#todo – related to kerning, I might need to have different prefabs for different widths of texts, if I want this to be automatic. OR I can just do it manually for a while. It really doesn’t interfere with anything, and I believe that having automated feedback would be FAR more desired by teachers than having the kerning be perfect. So let’s keep to our priorities here!

Okay, so possibly instead of having just the answer block as prefab, I should maybe have the entire answer situation (3 colorful slots + block) as prefab. That way they’ll each look the same. This argument could also be made for onset, middle, and coda rows, but I’m not sure about it yet. It feels right-er for the answer portion, but I can’t pinpoint exactly why.

Ooh now that my z numbers aren’t bonkers, I can zoom in on everything. Was that actually just because they weren’t even, and it was messing with it? Can’t say for sure but whatever it is, this is nicer this way.

Okay, so when all the blanks are filled in, there can be a big “check your work” button. This avoids having kids try to press the button before finishing. It’s not ideal, because it may encourage them to hit it and get the answers – so something about the feedback system will eventually want to be encouraging them to do self-reflection.

#todo Plan for giving feedback: I’ll start just giving them the answers. Then I’ll move on to saying how many they got right on the first try, then the second try (and recording it somewhere, so that they’re encouraged to go back and check their work before pressing the button), then I’ll potentially move on to automated/guided feedback.

#todo Gosh I gotta fix the appearance of my menu. It’s needlessly html-looking.

I wonder if I should try to just get a single scene into the app store, or if I should try to get a small menu up and running. That might make more sense, and look less like a Beta version. Although if that doesn’t work, I can always go back to the single scene version.

#todo

Thing to fix – now that they’re all beautifully in the same z spot, they actually overlap each other in disturbing and distracting ways. Fix this soon.

#todo : make prefabs for quiet blocks that don’t have playsound script on them

wth is “graphic raycaster script” on the menu? Without it the buttons don’t work. Fascinating.

I removed “Canvas scaler” and it still works, but doesn’t get rid of the 2 yield signs “the rferenced script on this behavior is missing” and “the reerenced scirpt on this bheavior (Game Object “) is missing!

So I put canvas scaler back on cuz I think that has something to do with how the canvas appears on different pieces of technology.

Okay, so now I’ve got it reduced down to just 3 levels, and it’s mad at me for something about the buttons in the menu.

https://forum.unity3d.com/threads/solved-the-referenced-script-on-this-behaviour-is-missing.381611/

WOOOOO I FIGURED IT OUT it was something about the Menu button inside the levels. Basically when the scene loaded it seems to have noticed that the Menu button’s script was defunct, and then threw a warning. Odd that it didn’t show up when the level was loaded by itself (as opposed to through a button on the menu), but that’s okay – I feel pretty good about being able to find errors like that faster now.

That being said, there’s apparently this magic script that can go find them – but after about 30 seconds of trying to use it, I couldn’t figure out how to.

Finding Missing References in Unity

#todo – at some point I’d love to figure out how to use this as a tool. Wasn’t worth the rabbit hole this time tho.

Do I need to compress the audio and/or delete all the audio that’s not immediately relevant? That might be worth it, keep the size down.

Now I’m going to the backup copy to find out what words were in the other scenes, since I totally messed with these. Backups are important!

I’d like to go make mockups of everything, with the content in it, so that if smething happens iwth Unity, it just isn’t a big deal.

8/17 – So yesterday evening around 6:30PM I finished getting it set up pretty-like with 3 levels (2 difficulties each) and a single menu screen. No errors or warnings!

Today my goal is to start the process of getting it on the app store. This is going to be pretty painstaking so I’m going to keep careful logs of it and be patient with myself.

 

Make answer blocks buttons

Guys!!! OMG OMG OMG. I’m pretty psyched bc when I was thinking about some sort of app store preview, I realized that it would be better if the answer blocks were buttons and were shaded when you pressed them.

Sooo I quickly whipped that up in my app, used the prefab, and then made the necessary alterations!

  • made a button the size I wanted (155×53 in Unity width/height, but there’s some scaling stuff going on from being a child of other stuff … honestly I’m not super sure I understand this but I’m at least writing what I did)
  • used the source image AnswerBlock190x88 (unsure if this is necessary)
  • in Button Script, made the pressed color darker (A9A9A9FF)
  • The button is childed to each number instance under Answers. Text is a separate child (This may be wrong, but I wanted to keep using my textmesh script … should probably make this simpler at some point #todo)
  • Then, I put the entire Answers chunk under Canvas (it won’t show up unless you do that, since it’s UI entities)
  • Changed z numbers to the following:
    • Answers: 0
    • Button: -1 (as long as it’s a lower number than Text, it will hide the Text)
    • Text: 0

Xcode error fixing

  • does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled

For this one, I unchecked and then rechecked each of the libraries on the right side bar. I believe that the error then went away, because I started at 348 and now I’m at 347.

Hmmm. I seem to have forgotten to clean my Xcode before building. Seeing if that helps.

Actually now the build failed, and there are 365 buildtime issues. Um.

Okay, so it turned out it had forgotten it had a link to a library. Went it checked and unchecked it, and now it’s happy. Still 355 issues.

Apparently these aren’t supposed to cause problems for app store reviewing ? (from 2014) …

https://forum.unity3d.com/threads/unity-ios-64-bit-support.287172/page-3

I’m getting some sort of memory leak …

https://spin.atomicobject.com/2016/01/25/ios-memory-leak-xcode/

Okay. I’m going to just try to upload it to iTunes connect and come back if there are more problems, because my build is succeeding

Update:

I apparently had gotten it all set on my apple developer page, but NOT in my iTunes Connect My Apps section of that app. It validated and found it nicely, then had a random, different error. Going to see if I can replicate it right now.

The other thing I’m looking at is the app preview. This website has a pretty easy way to do it:

https://developer.apple.com/support/app-previews/

It makes me wonder if I need to have the white flashcards make some sort of button behavior, like change color when they’re touched. Otherwise, it won’t show up in the app preview.

Okay, the upload was successful this time.

Oh! I didn’t realize this, but now it gets processed by Apple before I get to fiddle with it in my iTunes Connect. Okay, cool! First step done. Apparently I get an email from them when they’re done processing.

https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/UploadingBinariesforanApp.html

WOOOOOO okay this is silly but I’m going to memorialize this email:

Dear Brittany Mclaughlin,

The following build has completed processing:

Platform: iOS
App Name: Vowel Teams
Build Number: 0
Version Number: 1.0
App SKU: SU0817171
App Apple ID: 1272798152

You can now use this build for TestFlight testing or submit it to the App Store.

If you have any questions regarding your app, click Contact Us in iTunes Connect.

Regards,

The App Store team

Good job, me!

Do I need to handle the fact that it’s clearly designed for kids? Or can I say it’s an early reading app just for people in general.

Text I wrote for promo:

Do you work with early readers? Are they struggling with phonics concepts like vowel teams? Use this as a tool to help them build words with letters and sounds.

Text I wrote for description:

This is a tool for those helping people learning how to read practice tricky concepts about letters and sounds. It has been used successfully in reading programs with tutors.

First, choose the level and difficulty – start with Level 1, easy mode. This has all the sounds on each of the chunks. Show the early reader how to press all of the buttons, listen to the sounds, and repeat them. Then, start solving the puzzle – when pressed, the white block says a word. Build the word out of the letter chunks, matching the colorful blocks to the same color slot. Don’t correct them right away if they mix something up – this tool is designed for them to reflect on their own answers. Once they’ve filled in all the words in the level, help them sound out each word. As they sound it out, see if they find their own mistakes – if they don’t, ask broad questions like – is that the same sound you hear in the answer block (and press the answer block).

After the person you are tutoring is comfortable with easy mode, challenge them to hard mode! Here, the only blocks that make noise are the white answer blocks. Encourage them to sound out the colorful blocks while they select them, and correct them as they go if they are using the wrong sounds. If this level is too tricky or discouraging, repeat the easy levels and do word building exercises with similar letter and sound combinations outside of the app.

Remember, this is a tool to help you tutor! You’ll want to reinforce the skills practiced in this tool with outside reading (especially with related words), and other early reading activities.

 

Changed it to adults:

 

Promo:

Do you tutor adults learning how to read? Are they struggling with phonics concepts like vowel teams? Use this as a tool to help them build words with letters and sounds.

Description:

This is a tool for those helping adults learn how to read, where they can practice tricky concepts about letters and sounds. It has been used successfully in reading programs with tutors.

First, choose the level and difficulty – start with Level 1, easy mode. This has all the sounds on each of the chunks. Show the early reader how to press all of the buttons, listen to the sounds, and repeat them. Then, start solving the puzzle – when pressed, the white block says a word. Build the word out of the letter chunks, matching the colorful blocks to the same color slot. Don’t correct them right away if they mix something up – this tool is designed for them to reflect on their own answers. Once they’ve filled in all the words in the level, help them sound out each word. As they sound it out, see if they find their own mistakes – if they don’t, ask broad questions like – is that the same sound you hear in the answer block (and press the answer block).

After the person you are tutoring is comfortable with easy mode, challenge them to hard mode! Here, the only blocks that make noise are the white answer blocks. Encourage them to sound out the colorful blocks while they select them, and correct them as they go if they are using the wrong sounds. If this level is too tricky or discouraging, repeat the easy levels and do word building exercises with similar letter and sound combinations outside of the app.

Remember, this is a tool to help you tutor! You’ll want to reinforce the skills practiced in this tool with outside reading (especially with related words), and other early reading activities.

 

Alright. Now it’s “waiting for review”.

In the meantime, I should get a privacy policy for this app… right?

 

 

Building & Xcode

Yesterday I finished a MVP version of the vowel teams (3 levels, 2 difficulties each, one menu screen) with no errors or warnings in Unity.

Today my goal is to start the process of getting it on the app store. This is going to be pretty painstaking so I’m going to keep careful logs of it and be patient with myself.

This is a new computer, so first I think I have to just get Xcode set up, remember my logins as an apple developer, etc.

Ooh I’m going to add these into my Debug logs.

https://docs.unity3d.com/ScriptReference/Debug-isDebugBuild.html

Did that!

At some point, I might want to go clean up the comments in my scripts – they’re little notes to myself and aren’t always well done. #todo

I made a new cover for it (basic orange square with the words “Vowel Teams” centered on it), cover.png.

Now I’m going to figure out how to automatically sign my app.

https://docs.unity3d.com/ScriptReference/PlayerSettings.iOS-appleDeveloperTeamID.html

Cool, my team ID is under my membership account info.

https://developer.apple.com/account/#/membership

So, I already have an itunes connect thing.

https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html#//apple_ref/doc/uid/TP40011225-CH13-SW1

Logging into that.

https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html

Do I want to try this as a test build first? Think about this.

Test information draft: This app is a tool to help any early reader practice building words out of sounds and letters. It has been used in community-centered reading programs and has helped early readers improve their skills. It is often used in combination with a reading tutor to help check the answers. First, the user clicks on which level they want to practice. Then, they click on the white answer blocks to hear the words to build. To build the words, the user touches each of the colorful letter blocks, listens to the sounds, and compares them to the sounds in the white blocks. The user moves the letter blocks to the matching color slots next to the white answer blocks. Finally, if available, a tutor or friend helps the user listen to the sounds and check if the answers are correct.

 

https://unity3d.com/learn/tutorials/topics/interface-essentials/build-and-player-settings

 

I’m getting 3 warnings when I build my unity:

  1. Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices.
    UnityEditor.HostView:OnGUI()
  2. Microphone class is used but Microphone Usage Description is empty. App will not work on iOS 10+.
    UnityEditor.HostView:OnGUI()
  3. Splash screen images not provided: iPad Portrait, iPad Landscape, iPad Portrait/Retina, iPad Landscape/Retina
    UnityEditor.HostView:OnGUI()

Huh. Looks like this is a known bug, and can prevent the app store from accepting submission.

https://issuetracker.unity3d.com/issues/ios-webcamtexture-and-microphone-classes-are-used-in-empty-unity-projects

Hmph. I tried to get rid of #2 bc internet mentioned something about cameras, so I got rid of all of the “audio listener” components on all of my main cameras in each scene. To no avail, did another build and that error is still showing up.

I wonder if I should add those back in or not … ūüėČ

https://forum.unity3d.com/threads/ios-10-0-and-xcode-8-compatibility.430103/

Okay this is what AudioListener is. I don’t think I need it, but let’s keep an eye on it. LOL nm “There are no audio listeners in the scene. Please ensure there is always one audio listener in the scene” adding them back in now.

https://docs.unity3d.com/Manual/class-AudioListener.html

Huh. The error message about microphones just went away on its own. Now I’m just left with OnMouse_event handlers and Splash screen images. (I thought I didn’t need splash screen images bc I’m not using Unity pro?)

Ah. So I just checked, and when I deleted the comment that “No microphones are used in the app”, ¬†the microphone error came back. How interesting.

Alright I think I fixed the microphone issue. Using this. It’s in AV. I also turned off the camera thing. I might double up and also do the “No camera/location/microphone” is used in the Player Settings in Unity.

https://forum.unity3d.com/threads/ios-10-0-and-xcode-8-compatibility.430103/

Okay, so I fixed #3 (the splash screen error) by uploading images for ipad screens. Despite the fact that using unity personal doesn’t come with splash screens. Let’s see if that keeps it okay.

Now onto #1, because I think I’ve solved #2. #1 is the stuff about OnMouse even handlers.

There seem to be mixed ideas on whether or not this was actually a problem 3 years ago (http://answers.unity3d.com/questions/124198/onmousedown-alternative-for-mobile.html).

Let’s see if I can find something more recent.

Here’s an unpleasant way to do that someone posted recently (http://answers.unity3d.com/questions/1366245/what-shall-i-use-instead-of-onmouse-event-handlers.html), but links to 3 years ago again: it:¬†http://wiki.unity3d.com/index.php/OnTouch

This one looks cleaner.

https://stackoverflow.com/questions/44583542/what-shall-i-use-instead-of-onmousexxx-event-handlers

Is there something I can do with an if statement so that it does MouseDown if it’s on the computer, by raycast if it’s mobile? Or am I just making this for IOS so it doesn’t matter.

Implementing Touch Controls in Unity 3D

sigh: http://answers.unity3d.com/questions/908834/onpointerdown-vs-onmousedown.html

“So the answer to that is that you use OnPointerDown on UI objects, while using OnMouseDown for in scene objects.”

 

This is what I’ve been using : “http://answers.unity3d.com/questions/566327/drag-object-relative-to-camera.html”

Going to give this a shot on my ipad – I haven’t tried this new version on an ipad yet (bc I didn’t have the dongle thing, eek!), but I’ll get this going on multiple sides if I do that too.

Cleaned in Xcode: I have no idea what this means but it looks like it reduced my warning signs by dozens upon dozens. I guess it can just automatically handle a lot of the stuff?

Red library: One of my libraries is showing up as red in the left sidebar in Xcode, which apparently is non-ideal. [https://sourceforge.net/p/zbar/discussion/1072195/thread/5f8be82d/#3388] says it might be because interlinked libraries depend on each other but may be in the wrong order.

So, I wound up clicking on the file where it came from (to the right), and the only thing it had available was a .tbd file by the same name, so I linked it to that one instead. After I quit and reloaded, the red was gone.

LaunchScreen weirdness

This is acting weird Рdo I even need it?  What happens if I delete it and its corresponding .png?

LaunchScreen-iPad.xib

https://www.google.com/search?q=purpose+of+LaunchScreen-iPad.xib&rlz=1C5CHFA_enUS757US757&oq=purpose+of+LaunchScreen-iPad.xib&aqs=chrome..69i57j0l5.2265j0j7&sourceid=chrome&ie=UTF-8

Removed references to them, and … it seems okay? It got Buildtime errors down to 0, but I haven’t actually built it on the ipad (annoyingly, waiting for the update on that one now, so …)

Updating iPad ios to 10.3.3¬† – seeing if this helps me make the right type of build. The problem is, a lot of iPads that community centers have won’t be able to work with this high an ios, so I need to go somewhere where I have access to older ios systems, too. Or simulate them? Unsure which one makes more sense. #todo

8/18:

I’m getting the following error when I open up Unity. As far as I know it’s new. The link below believes it’s a benign error due to updates. Putting it here to keep an eye on.

Error loading launcher://unity//Users/britts/Library/Unity/Packages/node_modules/unity-editor-home/dist/index.html?code=CYEA0W_h9FpWtn1Av8PPJg003f&locale=en&session_state=8600923c3b9541c337c4e10a78c884dc809a25d49afa747c48c2d3686eb466fa.ergTREDfc8PXm5X1NmCXLg002f#/login

https://forum.unity3d.com/threads/error-loading-launcher.486127/

Another odd error I’m getting:

Metal: Editor support disabled, skipping device initialization

Well that one seems to literally be about rendering metallic shading.

https://forum.unity3d.com/threads/mac-editor-metal.446365/

Alright, I’ve got 348 buildtime errors. Let’s see if I can get that to 300 today.

My .xctest is red, and doens’t appear to exist.

What is a storyboard? Main.storyboard?

Getting back into it

I’ve been away from Unity for a while, and now am coming back to get a fresh start. It’s amazing how simultaneously hard it is to get my brain back into it, but also – how much clearer some of the solutions are.

Yesterday I started cleaning up one of my apps to delete all scenes, prefabs, scripts, and assets in general that aren’t necessary for it. I had made the horrible mistake of merging ALL OF MY STUFF EVER in an attempt to make ONE BIG APP for the kiddos I work with. This may have been a good idea for that summer program last year, but it certainly isn’t the right way to make an app.

Today I’m continuing to clean it out, and considering ways to redo the whole thing.

This website I came across in the past (but honestly didn’t use much of bc I didn’t understand everything) is very helpful, and this time I’m trying to go through and understand the advice:

50 Tips for Working with Unity (Best Practices)

The point I’m working on now is – how to make scenes. Since you can’t have nested prefabs in Unity, how can I make my prefabs arranged in the same way in each scene? There’s some stuff about prefabs being linked that I don’t quite get, so I need to keep working on this. ¬†[this is a start to explaining it, but honestly I’m still not there in terms of understanding:¬†http://answers.unity3d.com/questions/761454/what-does-it-mean-to-link-prefabs.html]

The internet seems to strongly advise against using a 3rd party thing to force Unity to have nested prefabs.

A lot of the advice around this says something along the lines of “use your scenes as a second-level prefab”. Not quite sure how to do this, since each of my scenes uses the same template, but has some key differences.

One way:

  • have it load the same scene, but depending on the Game Manager’s count of “level”, apply scripts to add or take away components that it needs
    • this honestly feels pretty complicated for me right now, particularly because I would need it to input text from a spreadsheet. I’ve done this in the past, but given that I’m trying to get this in the app store quickly, and reluctant to introduce features that will add complications.

Another way:

  • Make a scene exactly how I want it, then duplicate it and adjust it for all the other scenes.
    • This requires having my prefabs linked up well so that when I change a prefab, it changes across scenes (which I need to do anyhow).
    • This won’t help with prefab placement, since it doesn’t keep transform locations.
    • This feels frustrating because I want a template that when I change it will affect all scenes. I so badly want a scene prefab! There must be a way to do this better than I’m doing it.

Also oh god I forgot what a class was. Maybe this time when I learn it it’ll stick better and I’ll understand it more.

Another set of things I don’t fully get, to come back to later:

http://answers.unity3d.com/questions/663650/levels-scenes-or-gameobjects.html

Okay, this one is encouraging someone to just make a scene each for each level. As a beginner, this feels right. I’m going to go back to this and see if I can hack around the problems I’m having with it: [http://answers.unity3d.com/questions/1089267/multiple-levels-best-practise.html]

Disable buttons after click – in progress

Eventually I want to disable buttons after students have done them a lot, but right now I want to just learn how to disable buttons at all.

This thread has a good script thing:

public void BtnOnClick() { gameObject.GetComponent<Button>().interactable = false; }

This too.

I tried :  gameObject.GetComponent<Button>().interactable = false;

Buuuuut it’s not saving it as disabled when it comes back to the StudentMenu, because it’s resetting every time. ¬†Huh. ¬†(Doublechecked by disabling the scene change, and it’s disabling the buttons as long as the scene doesn’t change! ¬†Oof.)

It might be that I need to make a list of all the buttons that should be disabled in the GM, add to it every time a button get clicked, and then apply that to the StudentMenu set up. ¬†#todo – Eventually I’ll change it to only disable buttons once students are doing really well on a thing (or to disable buttons that are too advanced, a la “unlocking” levels).

Also #todo РI need a review / matching game at the end of these things, to really see how things are going. (This has been Drag&Drop-4-26, moving on to Drag&Drop-4-26b to make changes to the GM.) (#to do Рmatch up blog posts to game versions?)

I’m going to leave this one till later – I think it’s more important that I set up exporting the data from the game, because before I put many parameters on how kids can use the game, I need to know what they actually do with it.

 

Working on buttons – same content across levels

So a problem I’ve been having – that the below returns objects in a random order:

GameObject[] buttons = GameObject.FindGameObjectsWithTag(Button);

        foreach (GameObject button in buttons)
        

is apparently a known thing, and can’t be controlled (as discussed in this thread). ¬†So that means ¬†if I want it left to right, I need to retrieve the children of the Canvas, instead of getting objects tagged as “Button”. ¬†Grrr.

I don’t think I actually need to do this, after all, because what I’m actually going to do is instantiate each of these buttons from prefabs. Easy peasy.

ARE YOU KIDDING ME, PREFABS DON’T SAVE THE MANUAL “ONCLICK” THING INSIDE BUTTONS? ¬†ARHGGHGH WHAT IS EVEN THE POINT OF THAT THEN WHY NOT JUST SCRIPT EVERYTHING.

Grrrr. ¬†Oh. ¬†I see. ¬†It loses that connection because it was inside the Editor that it was connected to the Main Camera’s script. ¬†So.. do I need a prefab of the Main Camera or something? ¬† Cool. ¬†Did that, updated the prefabs from the buttons to connect to the Main Camera prefab (this feels a little cheaty slash convoluted but oh well?), and now things work great.

       foreach (string level in levels) // yield sign says level isnt used ...? 
        {

        // everything down here is totally redundant but it works so oh well 
            if (xMult == 0)  
            {
                yMult = yMult1;
                xMult = 3;
                xSpace = 0; 

                Vector3 buttonPosition = new Vector3(baseX * xMult + xSpace, baseY * yMult, 10f);
                GameObject button = Instantiate(buttonLearn, buttonPosition, Quaternion.identity) as GameObject;
                button.transform.SetParent(canvas.transform, false);    
                buttonCounter += 1;
                xMult += 1;
                xSpace += 160; 
            }
            else if (xMult == 2)
            {
                Vector3 buttonPosition = new Vector3(baseX * xMult + xSpace, baseY * yMult, 10f);
                GameObject button = Instantiate(buttonPractice, buttonPosition, Quaternion.identity) as GameObject;
                button.transform.SetParent(canvas.transform, false);    
                buttonCounter += 1;
                xMult += 1;
                xSpace += 160; 
            }

            else
            {
                Vector3 buttonPosition = new Vector3(baseX * xMult + xSpace, baseY * yMult, 10f);
                GameObject button = Instantiate(buttonShowOff, buttonPosition, Quaternion.identity) as GameObject;
                button.transform.SetParent(canvas.transform, false);    
                buttonCounter += 1;
                xMult += 1;
                xSpace += 160; 
            }

So now it’s making buttons in the right color, prefab, order, etc. ¬†Now I need it:

  • to look prettier / be better spaced
  • not change levels until the row is done ¬†– that’s something about the name script
  • be well-labelled for kiddos (clear about how many points each button is)
  • have levels that make more sense for learning early concepts

Alright I made it so it doesn’t change levels till row is done, but now things are SERIOUSLY buggy. ¬†It’s not resetting because of something with the Notebook/Trash entries. ¬†Doesn’t seem to have anything to do with the code I put into NameButtons():

            buttonSpacer += 1;
            if (buttonSpacer == 3)
            {
                buttonCounter += 1;
                buttonSpacer = 0;
            }

As always, that particular problem is caused by it not reading in the .txt correctly. ¬†It’s something about converting the string to an integer. ¬†Have no idea what it is about the Unity Editor that messes with that, but … oh well. ¬†(#todo – continue google searching for why this is happening. ¬†Someday I’ll find the answer!) ¬†Fixed it by changing what .txt file it was reading in. ¬†Le sigh.

This one restructures it so that there’s space between the rows and the columns.

  void CreateButtons()
    {

        GameObject canvas = GameObject.Find(Canvas);

        // pull in info 
        TextAsset txtFile = (TextAsset)Resources.Load(PuzzleBotGoogleLevel, typeof(TextAsset)); // redundant :(  lots of scripts do this ... condense? put it in GM? 
        string[] levels = txtFile.text.Split(\n); // #todo why does \r not work? 

        // space buttons out on screen 
        float bufferX = Screen.width  50f;
        float bufferY = Screen.height  100f;
        float baseX = (bufferX / 3f); 
        float baseY = bufferY / 3f; 

        int xMult = 0; // set it to 0, if loop will convert to 3  
        int yMult = 4; 
        int xSpace = 0;
        int ySpace = 150 ;
       
        int buttonCounter = 0;

        foreach (string level in levels) // yield sign says level isnt used ...? 
        {

        // everything down here is totally redundant but it works so oh well 
            if (xMult == 0)  
            {
                yMult = yMult1;
                xMult = 3;
                xSpace = 0; 

                xSpace += 160; 
                Vector3 buttonPosition = new Vector3(baseX * xMult + xSpace, baseY * yMult + ySpace, 10f);
                GameObject button = Instantiate(buttonLearn, buttonPosition, Quaternion.identity) as GameObject;
                button.transform.SetParent(canvas.transform, false);    
                buttonCounter += 1;
                xMult += 1;

            }
            else if (xMult == 2)
            {
                xSpace += 160;

                Vector3 buttonPosition = new Vector3(baseX * xMult + xSpace, baseY * yMult + ySpace, 10f);
                GameObject button = Instantiate(buttonPractice, buttonPosition, Quaternion.identity) as GameObject;
                button.transform.SetParent(canvas.transform, false);    
                buttonCounter += 1;
                xMult += 1;
                 
            }

            else
            {
                xSpace += 160; 

                Vector3 buttonPosition = new Vector3(baseX * xMult + xSpace, baseY * yMult + ySpace, 10f);
                GameObject button = Instantiate(buttonShowOff, buttonPosition, Quaternion.identity) as GameObject;
                button.transform.SetParent(canvas.transform, false);    
                buttonCounter += 1;
                xMult += 1;
                ySpace -= 50; 
            }

        } 

    }

Let’s go back to my list above:

So now it’s making buttons in the right color, prefab, order, etc. ¬†Now I need it:

  • to look prettier / be better spaced¬†
  • not change levels until the row is done ¬†– that’s something about the name script¬†
  • be well-labelled for kiddos (clear about how many points each button is)
  • have levels that make more sense for learning early concepts

And I’m going to add:

  • label buttons appropriately (this is going to do a weird thing where it’s going to make it hard for me to call up the level, since I’ve been using button numbers to do that. ¬†How about I keep the level number in there, to just keep things simple for now.)
    • This now just says level:¬† buttonText.text¬†=¬†levels[buttonCounter].Split(\t)[0];
    • This one says level and word family :¬† buttonText.text¬†=¬†levels[buttonCounter].Split(\t)[0]¬†+¬†\t¬†+¬†levels[buttonCounter].Split(\t)[2];¬†¬†¬†¬†//¬†switched¬†to¬†this¬†so¬†it¬†just¬†says¬†level,¬†not¬†content
    • #todo – in playtesting, figure out what kids like in these buttons – how much info to give?

Just changed all the button prefabs to be 80 wide (kept 30 height).  Looks MUCH better.  I thought I had to change size through scale, but was wrong (yayy cuz scale affects text in unpleasant ways).

Okay so now I need to be true to my word and actually have scoreValue change inside each type of button. [#todo – playtest if it’s better to shower them with points, or if it’s better to be medium, or to have it be relatively conservative?]

I define a public int inside the GM that’s different for each type of Scene (which I already have if{} loops for so it defines where the audio happens).

    public void Audio()
    {
        Scene scene = SceneManager.GetActiveScene();
        if (scene.name == 1Learn)
        {
            audioList.Add(Onset);
            audioList.Add(Ending);
            audioList.Add(Answer);

            scoreValue = 5; 
        }
        else if (scene.name == 2Practice)
        {
            audioList.Clear();
            audioList.Add(Ending);

            scoreValue = 10;
        }
        else if (scene.name == 3ShowOff)
        {
            audioList.Clear();

            scoreValue = 15; 
        }

In PlayerFinalWord.cs, I changed it from defining scoreValue inside that loop to it pulling it in from the GM instance.

GameManager.instance.AddScore(GameManager.instance.scoreValue); 

Huh. ¬†Just realized it’s only making 2 rows of buttons (6 total), where it the txt file actually has 9 rows (27 total buttons). ¬†Why does it stop after the second row? ¬† I only really want 3 rows, but it should be able to do 9. ¬† Therrrrre we go, CreateButtons() was referring to the wrong .txt file. ¬†Yay that was easier than I thought it would be!

#todo – draw a map of everything in the project, how scripts connect, etc. ¬†Do some “official” documentation (that is, outside of this blog).

 

Early programmer documenting coding problems & solutions – Unity3D / C#