Trouble with SKAudioNode - swift

In my app when the screen is touched I want to play my file "pewpew.mp3". It is not working. I've looked at several of these posts but none of the are working. This is my code:
let shootNoise = SKAudioNode(fileNamed: "pewpew.mp3")
shootNoise.autoplayLooped = false
addChild(shootNoise)
shootNoise.run(SKAction.play())
hero.run(playNoise)
That is all inside of the
override func(touchesEnded)
Any ideas? I feel like I'm over-thinking this.

I'm late to answering this - but the code should/does work... so a couple of quick checks - is the file name and extension correct? Is the code block being run (ie, are touches ended being detected correctly). Are there other things in the scene that have changed the way sounds would be played? if you run this code in your app in a blank scene - does it work? (would have written a comment but am not allowed).

Related

Weird behaviour when I try to Pause/Unpause Game with same button in Unity

I am trying to Pause and Unpause the game using the ESCAPE button, but I encounter a strange bug.
Update.png
Pause-UnpauseGame.png
When I have the code like this, it behaves how it's supposed to - It pauses the game when I press the pauseKey(ESC).
If I uncomment the commented line in the Unpause method, the one that should hide the UI and set Time.timescale back to 1, (almost) everything breaks. The functionality from the PauseGame method that previously worked doesn't work anymore.
When I uncomment the Debug.Log calls from the PauseGame method, the correct values are displayed, but nothing happens. The game isn't frozen although it says that Time.timeScale is 0.
DebugLog.png
These are the rest of the methods that are referenced in the screenshots posted above:
OnResumePressed.png
CloseAllMenus.png
Any idea, piece of guidance, or reliable source that you think might help is very welcomed.
Thank you for your time and attention!
Your code is pausing the game then the next line unpauses (the now paused) game. Make it an if () {} else {} and it should work ok.

Unity Glitching when I run the Game

I made a Model of the solar system and when I run the program this happens:
I am not sure what is causing this so if you have any idea Pls Reply.
The Scene load is being triggered multiple times:
Check if you have any code that you're using to load the scene (In Update, perhaps?) if youre using it in update, check if you're using GetKey instead of GetKeyDown (GetKey will remain true as long as you keep it pressed)
The information provided here is too little and we can only speculate at this point. please post code, more images and a better description of the problem. How did you reproduce this issue?

SKView warning logs

When running my SwiftUI & SpriteKit app, I get the following messages in the logs:
2019-11-18 21:58:57.631912+0000 PixelBattles[2812:1215803]
SKView: ignoreRenderSyncInLayoutSubviews is NO. Call _renderSynchronouslyForTime without handler
What am I doing wrong to receive this log, and should I worry about it? Could it be a bug?
Could it be that SwiftUI cannot figure out how to do the layout for an SKView?
Major edit:
If you need code, you can see it in the previous edits. Below I state why I don't think it is any longer relevant.
I have sent Apple some feedback (FB7456217). I have removed the code, as I no longer suspect it is an issue to do with my code. I created a blank game project, no SwiftUI, and still got the same warning log instantly.
So even with the default project template, the log still appeared for device and simulator. I will update on this issue if I get a useful response.
I still haven't heard anything back - has anyone got any new information since when I posted this over half a month ago? I still have these warnings!
This is Apple's response to this issue:
Hi! You don't really need to fix that. That's a log message that was
left by mistake in SpriteKit framework. It was removed and will no
longer appear in the future SpriteKit versions. Thanks!
just figured this out for myself.
In your code change
if let scene = SKScene(fileNamed: "GameScene")
to
if let scene = GameScene(fileNamed: "GameScene")
I believe you'll also get this warning if you have UIKit subviews of the SKView.

Use multiple components in Flash AS3 - iPhone app

First of all: Happy new year!
I have a problem with Flash CS5.5, AS3. I have two ScrollPane Components in my document. They are both in another scene and the (instant)names are unique. But it isn’t working properly. When I go to the other scene with the second ScrollPane I get an error & it starts to flicker.
My error:
TypeError: Error #1006: setSize is not a function. at
application051_fla::MainTimeline/frame25()[application051_fla.MainTimeline::frame25:7]
I want to make an iPhone application and I want that multiple components working properly in one document.
My little piece of code (don’t think that the problem is in here):
ScrollPane02.source = tekst03;
ScrollPane02.setSize(350,400);
ScrollPane02.move(0, 20);
ScrollPane02.scrollDrag = false;
If you know the answer or what I am doing wrong, please comment! Searching for hours/days!
Thanks in advance!
Uploaded the .fla document. If you want to take a look at it (please), you can download it here: http://www.bregjebouwmans.nl/application061.fla
Edit:
Ok, after digging through the FLA, I finally figured out what you did . . . you right clicked on ScrollPane in the "Library", and clicked "Duplicate". Then you gave it the name ScrollPane02. Except that the duplication process did not connect the new object to the ScrollPane's setup. Instead, it created a generic MovieClip object. Since it is not an actual ScrollPane, it makes sense that all the methods on the timeline's Actionscript will fail.
This is why the solution (in the comments below) works. #AsTheWormTurns just used the first (actual) ScrollPane in two instances on the timeline; is a viable solution.
(The only caveat being that if you change the ScrollPane object in the Library, it will affect all instances. That shouldn't really be a problem, since -- for components -- you generally make changes only to instances.)
Useful tips from my initial answer:
When compiled into an SWF, scenes are just stuck one right after the other in the timeline, just like scenes in a movie. If you do not have a stop() at the end of one scene, it will continue to run right into the next scene, just like a movie. The idea of scenes is to separate content. This means that what exists in sceneA does not exist in sceneB. The scenes also have no access to each other.
My advice is to not use scenes at all. They are difficult to use correctly, and have very little use that is not better done using the timeline or Actionscript.

AudioStreamer appDelegate

I have two things concerning AudioStreamer and i hope I'm getting some clues here:
1. I have set up a UITabBarController and in my Appdelegate is a AudioStreamer-Object. Two views refer to the appDelegate.streamer. It it looks like that im getting two sessions when i release and alloc it new. I get two running audiosession.
2. I use a UITableView to play out of this list. in the didSelectRowAtIndexPath-method I initialize with a URL. when the user taps with a fast double, or tripple-click. the audiosession will get startet three times. although i'm using a bool to prevent that. so my dirty solution is to set the system sleeping for a second. it is ugly because the screen freezes for a sec.
Thankfull for some hints
Simon
In terms of your problems, it sounds like you should implement your AudioSteamer as a singleton, as this will prevent multiple instances from being created and provide a single point to control playback (i.e.: prevent multiple taps from triggering multiple playbacks).
For more information on how to create a singleton class, see the "Creating a Singleton Instance" section within Apple's Cocoa Fundamentals Guide.
for 2nd point. It is a bug of AudioStreamer class. Also this has been solved and code is put up on gitHub see link. also if this does not seems working then you can go to the pause method and add more states as below
-(void)pause
{
if (state==AS_PLAYING || state==AS_BUFFERING || state==AS_WAITING_FOR_DATA)
{
//rest code goes same....
}
// rest code goes same....
}
this solved my same problem. Hope this will help you also...